Public interface to you library.
Procs
proc checkTable[T: ref object](db: Db; t: typedesc[T])
- Checks to see if table matches the object. And recommends to create whole table or alter it. Source Edit
proc createIndexStatement[T: ref object](db: Db; t: typedesc[T]; ifNotExists: bool; params: varargs[string]): string
- Returns the SQL code need to create an index. Source Edit
proc createTableStatement[T: ref object](db: Db; t: typedesc[T]): string
- Given an object creates its table create statement. Source Edit
proc openDatabase(path: string): Db {....raises: [DbError], tags: [], forbids: [].}
- Opens the database file. Source Edit
proc sqlDumpHook(v: bool): string {....raises: [], tags: [], forbids: [].}
- SQL dump hook to convert from bool. Source Edit
proc sqlite3_bind_text(stmt: Statement; index: int32; text: cstring; size: int32; destructor: pointer): int32 {.importc, cdecl, ...raises: [], tags: [], forbids: [].}
- Source Edit
proc sqlite3_close(db: Db): int32 {.importc, cdecl, ...raises: [], tags: [], forbids: [].}
- Source Edit
proc sqlite3_column_blob(stmt: Statement; iCol: int32): pointer {.importc, cdecl, ...raises: [], tags: [], forbids: [].}
- Source Edit
proc sqlite3_column_bytes(stmt: Statement; iCol: int32): int32 {.importc, cdecl, ...raises: [], tags: [], forbids: [].}
- Source Edit
proc sqlite3_column_count(stmt: Statement): int32 {.importc, cdecl, ...raises: [], tags: [], forbids: [].}
- Source Edit
proc sqlite3_column_name(stmt: Statement; iCol: int32): cstring {.importc, cdecl, ...raises: [], tags: [], forbids: [].}
- Source Edit
proc sqlite3_errmsg(db: Db): cstring {.importc, cdecl, ...raises: [], tags: [], forbids: [].}
- Source Edit
proc sqlite3_finalize(stmt: Statement): int32 {.importc, cdecl, ...raises: [], tags: [], forbids: [].}
- Source Edit
proc sqlite3_last_insert_rowid(db: Db): int64 {.importc, cdecl, ...raises: [], tags: [], forbids: [].}
- Source Edit
proc sqlite3_open(filename: cstring; db: var Db): int32 {.importc, cdecl, ...raises: [], tags: [], forbids: [].}
- Source Edit
proc sqlite3_prepare_v2(db: Db; zSql: cstring; nByte: int32; pStatement: var Statement; pzTail: ptr cstring): int32 {. importc, cdecl, ...raises: [], tags: [], forbids: [].}
- Source Edit
proc sqlite3_step(stmt: Statement): int32 {.importc, cdecl, ...raises: [], tags: [], forbids: [].}
- Source Edit
proc sqlParseHook(data: string; v: var bool) {....raises: [], tags: [], forbids: [].}
- SQL parse hook to convert to bool. Source Edit
proc tableExists[T](db: Db; t: typedesc[T]): bool
- Checks if table exists. Source Edit
Templates
template withTransaction(db: Db; body)
- Transaction block. Source Edit
Exports
-
Db, createIndexIfNotExists, DbError, upsert, sqlParseHook, sqlDumpHook, sqlParseHook, sqlDumpHook, toArgument, update, delete, sqlParseHook, filter, filter, dbError, validateObj, Bytes, sqlDumpHook, toSnakeCase, sqlParseHook, sqlParse, upsert, tableName, get, dropTable, update, sqlDumpHook, ReservedNames, hexNibble, delete, dropTableIfExists, Argument, sqlParseHook, sqlParseHook, insertInner, createIndex, createTable, innerSelect, Row, insert