From a6f960db76258a8a1f45ac4c9af9d1bc9261ec02 Mon Sep 17 00:00:00 2001 From: niinivaa Date: Tue, 16 Nov 2021 18:04:43 +0200 Subject: [PATCH] 3.0.0 --- docs/{sqliteral.html => index.html} | 132 ++++++++++++++-------------- 1 file changed, 66 insertions(+), 66 deletions(-) rename docs/{sqliteral.html => index.html} (79%) diff --git a/docs/sqliteral.html b/docs/index.html similarity index 79% rename from docs/sqliteral.html rename to docs/index.html index 29efa5b..a2ed1c9 100644 --- a/docs/sqliteral.html +++ b/docs/index.html @@ -516,7 +516,7 @@

Types

-
DbValue = object
+
DbValue = object
   case kind*: DbValueKind
   of sqliteInteger:
       intVal*: int64
@@ -538,7 +538,7 @@ 

Types

-
SQLError = ref object of CatchableError
+
SQLError = ref object of CatchableError
   rescode*: int
 
@@ -548,7 +548,7 @@

Types

-
SQLiteral = object
+
SQLiteral = object
   sqlite*: PSqlite3
   dbname*: string
   inreadonlymode*: bool
@@ -562,9 +562,9 @@ 

Types

laststatementindex: int internalstatements: array[MaxThreadSize, array[3 + 1, PStmt]] transactionlock: Lock - loggerproc: proc (sqliteral: SQLiteral; statement: string; errorcode: int) {. + loggerproc: proc (sqliteral: SQLiteral; statement: string; errorcode: int) {. ...gcsafe, raises: [].} - oncommitproc: proc (sqliteral: SQLiteral) {....gcsafe, raises: [].} + oncommitproc: proc (sqliteral: SQLiteral) {....gcsafe, raises: [].} maxparamloggedlen: int Transaction: PStmt Commit: PStmt @@ -582,7 +582,7 @@

Types

Consts

-
MaxStatements = 100
+
MaxStatements = 100
Compile time define pragma that limits amount of prepared statements @@ -590,7 +590,7 @@

Consts

-
MaxThreadSize = 32
+
MaxThreadSize = 32
@@ -598,7 +598,7 @@

Consts

-
SQLiteralVersion = "3.0.0"
+
SQLiteralVersion = "3.0.0"
@@ -611,7 +611,7 @@

Consts

Procs

-
proc `$`[T: DbValue](val: T): string {.inline.}
+
proc `$`[T: DbValue](val: T): string {.inline.}
@@ -619,7 +619,7 @@

Procs

-
proc about(db: SQLiteral) {....raises: [SQLError, IOError, OSError],
+
proc about(db: SQLiteral) {....raises: [SQLError, IOError, OSError],
                             tags: [RootEffect, ReadIOEffect].}
@@ -628,7 +628,7 @@

Procs

-
proc bindParams(sql: PStmt; params: varargs[DbValue]): int {.inline, ...raises: [],
+
proc bindParams(sql: PStmt; params: varargs[DbValue]): int {.inline, ...raises: [],
     tags: [].}
@@ -637,7 +637,7 @@

Procs

-
proc cancelBackup(db: var SQLiteral; backupdb: PSqlite3;
+
proc cancelBackup(db: var SQLiteral; backupdb: PSqlite3;
                   backuphandle: PSqlite3_Backup) {....raises: [SQLError],
     tags: [RootEffect].}
@@ -647,7 +647,7 @@

Procs

-
proc close(db: var SQLiteral) {....raises: [SQLError], tags: [RootEffect].}
+
proc close(db: var SQLiteral) {....raises: [SQLError], tags: [RootEffect].}
Closes the database. @@ -655,7 +655,7 @@

Procs

-
proc columnExists(db: SQLiteral; table: string; column: string): bool {.
+
proc columnExists(db: SQLiteral; table: string; column: string): bool {.
     ...raises: [Exception, SQLError], tags: [RootEffect].}
@@ -664,7 +664,7 @@

Procs

-
proc doLog(db: SQLiteral; statement: string; params: varargs[DbValue, toDb]) {.
+
proc doLog(db: SQLiteral; statement: string; params: varargs[DbValue, toDb]) {.
     inline, ...raises: [], tags: [RootEffect].}
@@ -673,7 +673,7 @@

Procs

-
proc exec(db: SQLiteral; pstatement: PStmt; params: varargs[DbValue, toDb]) {.
+
proc exec(db: SQLiteral; pstatement: PStmt; params: varargs[DbValue, toDb]) {.
     inline, ...raises: [SQLError], tags: [RootEffect].}
@@ -682,7 +682,7 @@

Procs

-
proc exec(db: SQLiteral; statement: enum; params: varargs[DbValue, toDb]) {.
+
proc exec(db: SQLiteral; statement: enum; params: varargs[DbValue, toDb]) {.
     inline.}
@@ -691,7 +691,7 @@

Procs

-
proc exes(db: SQLiteral; sql: string) {....raises: [SQLError], tags: [RootEffect].}
+
proc exes(db: SQLiteral; sql: string) {....raises: [SQLError], tags: [RootEffect].}

Prepares, executes and finalizes given semicolon-separated sql statements.
For security and performance reasons, this proc should be used with caution.

@@ -734,7 +734,7 @@

Procs

-
proc getLastInsertRowid(db: SQLiteral): int64 {.inline, ...raises: [], tags: [].}
+
proc getLastInsertRowid(db: SQLiteral): int64 {.inline, ...raises: [], tags: [].}
https://www.sqlite.org/c3ref/last_insert_rowid.html @@ -751,7 +751,7 @@

Procs

-
proc getStatus(db: SQLiteral; status: int; resethighest = false): (int, int) {.
+
proc getStatus(db: SQLiteral; status: int; resethighest = false): (int, int) {.
     ...raises: [SQLError], tags: [RootEffect].}
@@ -772,7 +772,7 @@

Procs

-
proc getTheInt(db: SQLiteral; s: string): int64 {.inline,
+
proc getTheInt(db: SQLiteral; s: string): int64 {.inline,
     ...raises: [SQLError, SQLError], tags: [RootEffect].}
@@ -781,7 +781,7 @@

Procs

-
proc getTheInt(db: SQLiteral; statement: enum; params: varargs[DbValue, toDb]): int64 {.
+
proc getTheInt(db: SQLiteral; statement: enum; params: varargs[DbValue, toDb]): int64 {.
     inline.}
@@ -790,7 +790,7 @@

Procs

-
proc getTheString(db: SQLiteral; s: string): string {.inline,
+
proc getTheString(db: SQLiteral; s: string): string {.inline,
     ...raises: [SQLError, SQLError], tags: [RootEffect].}
@@ -799,7 +799,7 @@

Procs

-
proc getTheString(db: SQLiteral; statement: enum; params: varargs[DbValue, toDb]): string {.
+
proc getTheString(db: SQLiteral; statement: enum; params: varargs[DbValue, toDb]): string {.
     inline.}
@@ -808,7 +808,7 @@

Procs

-
proc initBackup(db: var SQLiteral; backupfilename: string): tuple[
+
proc initBackup(db: var SQLiteral; backupfilename: string): tuple[
     backupdb: PSqlite3, backuphandle: PSqlite3_Backup] {.
     ...raises: [SQLError, SQLError], tags: [RootEffect].}
@@ -820,7 +820,7 @@

Procs

-
proc insert(db: SQLiteral; statement: enum; params: varargs[DbValue, toDb]): int64 {.
+
proc insert(db: SQLiteral; statement: enum; params: varargs[DbValue, toDb]): int64 {.
     inline.}
@@ -829,7 +829,7 @@

Procs

-
proc isIntransaction(db: SQLiteral): bool {.inline, ...raises: [], tags: [].}
+
proc isIntransaction(db: SQLiteral): bool {.inline, ...raises: [], tags: [].}
@@ -837,8 +837,8 @@

Procs

-
proc json_extract(db: var SQLiteral; path: string;
-                  jsonstring: varargs[DbValue, toDb]): string {.
+
proc json_extract(db: var SQLiteral; path: string;
+                  jsonstring: varargs[DbValue, toDb]): string {.
     ...raises: [SQLError, Exception], tags: [RootEffect].}
@@ -847,8 +847,8 @@

Procs

-
proc json_patch(db: var SQLiteral; patch: string;
-                jsonstring: varargs[DbValue, toDb]): string {.
+
proc json_patch(db: var SQLiteral; patch: string;
+                jsonstring: varargs[DbValue, toDb]): string {.
     ...raises: [SQLError, Exception], tags: [RootEffect].}
@@ -857,7 +857,7 @@

Procs

-
proc json_valid(db: var SQLiteral; jsonstring: varargs[DbValue, toDb]): bool {.
+
proc json_valid(db: var SQLiteral; jsonstring: varargs[DbValue, toDb]): bool {.
     ...raises: [SQLError, Exception], tags: [RootEffect].}
@@ -866,7 +866,7 @@

Procs

-
proc openDatabase(db: var SQLiteral; dbname: string; schema: string;
+
proc openDatabase(db: var SQLiteral; dbname: string; schema: string;
                   maxKbSize = 0; wal = true) {.inline,
     ...raises: [SQLError, Exception], tags: [RootEffect].}
@@ -876,7 +876,7 @@

Procs

-
proc openDatabase(db: var SQLiteral; dbname: string; schemas: openArray[string];
+
proc openDatabase(db: var SQLiteral; dbname: string; schemas: openArray[string];
                   maxKbSize = 0; wal = true; ignorableschemaerrors: openArray[
     string] = @["duplicate column name", "no such column"]) {.
     ...raises: [SQLError, Exception], tags: [RootEffect].}
@@ -906,7 +906,7 @@

Procs

-
proc optimize(db: var SQLiteral; pagesize = -1; walautocheckpoint = -1) {.
+
proc optimize(db: var SQLiteral; pagesize = -1; walautocheckpoint = -1) {.
     ...raises: [], tags: [RootEffect].}
@@ -917,7 +917,7 @@

Procs

-
proc prepareSql(db: SQLiteral; sql: cstring): PStmt {.inline,
+
proc prepareSql(db: SQLiteral; sql: cstring): PStmt {.inline,
     ...raises: [SQLError], tags: [RootEffect].}
@@ -926,7 +926,7 @@

Procs

-
proc prepareStatements(db: var SQLiteral; Statements: typedesc[enum])
+
proc prepareStatements(db: var SQLiteral; Statements: typedesc[enum])
Prepares the statements given as enum parameter. Call this exactly once from every thread that is going to access the database. Main example shows how this "exactly once"-requirement can be achieved with a boolean threadvar. @@ -934,7 +934,7 @@

Procs

-
proc rowExists(db: SQLiteral; sql: string): bool {.inline, ...raises: [SQLError],
+
proc rowExists(db: SQLiteral; sql: string): bool {.inline, ...raises: [SQLError],
     tags: [RootEffect].}
@@ -943,7 +943,7 @@

Procs

-
proc rowExists(db: SQLiteral; statement: enum; params: varargs[DbValue, toDb]): bool {.
+
proc rowExists(db: SQLiteral; statement: enum; params: varargs[DbValue, toDb]): bool {.
     inline.}
@@ -952,7 +952,7 @@

Procs

-
proc setLogger(db: var SQLiteral; logger: proc (sqliteral: SQLiteral;
+
proc setLogger(db: var SQLiteral; logger: proc (sqliteral: SQLiteral;
     statement: string; code: int) {....gcsafe, raises: [].}; paramtruncat = 50) {.
     ...raises: [], tags: [].}
@@ -967,7 +967,7 @@

Procs

-
proc setOnCommitCallback(db: var SQLiteral; oncommit: proc (sqliteral: SQLiteral) {.
+
proc setOnCommitCallback(db: var SQLiteral; oncommit: proc (sqliteral: SQLiteral) {.
     ...gcsafe, raises: [].}) {....raises: [], tags: [].}
@@ -976,7 +976,7 @@

Procs

-
proc setReadonly(db: var SQLiteral; readonly: bool) {....raises: [SQLError],
+
proc setReadonly(db: var SQLiteral; readonly: bool) {....raises: [SQLError],
     tags: [RootEffect].}
@@ -991,7 +991,7 @@

Procs

-
proc stepBackup(db: var SQLiteral; backupdb: PSqlite3;
+
proc stepBackup(db: var SQLiteral; backupdb: PSqlite3;
                 backuphandle: PSqlite3_Backup; pagesperportion = 5.int32): int {.
     ...raises: [SQLError], tags: [RootEffect].}
@@ -1010,7 +1010,7 @@

Procs

-
proc threadi(db: SQLiteral): int {....raises: [], tags: [].}
+
proc threadi(db: SQLiteral): int {....raises: [], tags: [].}
@@ -1018,7 +1018,7 @@

Procs

-
proc toDb(val: cstring; first, last: int): DbValue {.inline, ...raises: [],
+
proc toDb(val: cstring; first, last: int): DbValue {.inline, ...raises: [],
     tags: [].}
@@ -1027,7 +1027,7 @@

Procs

-
proc toDb(val: cstring; len = -1): DbValue {.inline, ...raises: [], tags: [].}
+
proc toDb(val: cstring; len = -1): DbValue {.inline, ...raises: [], tags: [].}
@@ -1035,7 +1035,7 @@

Procs

-
proc toDb(val: openArray[char]; len = -1): DbValue {.inline, ...raises: [],
+
proc toDb(val: openArray[char]; len = -1): DbValue {.inline, ...raises: [],
     tags: [].}
@@ -1044,7 +1044,7 @@

Procs

-
proc toDb(val: seq[byte]): DbValue {.inline, ...raises: [], tags: [].}
+
proc toDb(val: seq[byte]): DbValue {.inline, ...raises: [], tags: [].}
@@ -1052,7 +1052,7 @@

Procs

-
proc toDb(val: string; first, last: int): DbValue {.inline, ...raises: [], tags: [].}
+
proc toDb(val: string; first, last: int): DbValue {.inline, ...raises: [], tags: [].}
@@ -1060,7 +1060,7 @@

Procs

-
proc toDb(val: string; len = -1): DbValue {.inline, ...raises: [], tags: [].}
+
proc toDb(val: string; len = -1): DbValue {.inline, ...raises: [], tags: [].}
@@ -1068,7 +1068,7 @@

Procs

-
proc toDb[T: DbValue](val: T): DbValue {.inline.}
+
proc toDb[T: DbValue](val: T): DbValue {.inline.}
@@ -1076,7 +1076,7 @@

Procs

-
proc toDb[T: Ordinal](val: T): DbValue {.inline.}
+
proc toDb[T: Ordinal](val: T): DbValue {.inline.}
@@ -1084,7 +1084,7 @@

Procs

-
proc toDb[T: SomeFloat](val: T): DbValue {.inline.}
+
proc toDb[T: SomeFloat](val: T): DbValue {.inline.}
@@ -1092,8 +1092,8 @@

Procs

-
proc update(db: SQLiteral; sql: string; column: string; newvalue: DbValue;
-            where: DbValue) {....raises: [Exception, SQLError, SQLError],
+
proc update(db: SQLiteral; sql: string; column: string; newvalue: DbValue;
+            where: DbValue) {....raises: [Exception, SQLError, SQLError],
                               tags: [RootEffect].}
@@ -1107,7 +1107,7 @@

Procs

Iterators

-
iterator json_tree(db: SQLiteral; jsonstring: varargs[DbValue, toDb]): PStmt {.
+
iterator json_tree(db: SQLiteral; jsonstring: varargs[DbValue, toDb]): PStmt {.
     ...raises: [SQLError], tags: [RootEffect].}
@@ -1116,7 +1116,7 @@

Iterators

-
iterator rows(db: SQLiteral; pstatement: PStmt; params: varargs[DbValue, toDb]): PStmt {.
+
iterator rows(db: SQLiteral; pstatement: PStmt; params: varargs[DbValue, toDb]): PStmt {.
     ...raises: [SQLError], tags: [RootEffect].}
@@ -1125,7 +1125,7 @@

Iterators

-
iterator rows(db: SQLiteral; statement: enum; params: varargs[DbValue, toDb]): PStmt
+
iterator rows(db: SQLiteral; statement: enum; params: varargs[DbValue, toDb]): PStmt
Iterates over the query results @@ -1138,7 +1138,7 @@

Iterators

Templates

-
template checkRc(db: SQLiteral; resultcode: int)
+
template checkRc(db: SQLiteral; resultcode: int)

Raises SQLError if resultcode notin [SQLITE_OK, SQLITE_ROW, SQLITE_DONE]
https://www.sqlite.org/rescode.html

@@ -1146,7 +1146,7 @@

Templates

-
template transaction(db: var SQLiteral; body: untyped)
+
template transaction(db: var SQLiteral; body: untyped)

Every write to database must happen inside some transaction.
Groups of reads must be wrapped in same transaction if mutual consistency required.
In WAL mode (the default), independent reads must NOT be wrapped in transaction to allow parallel processing.

@@ -1154,7 +1154,7 @@

Templates

-
template transactionsDisabled(db: var SQLiteral; body: untyped)
+
template transactionsDisabled(db: var SQLiteral; body: untyped)
Executes body in between transactions (ie. does not start transaction, but transactions are blocked during this operation). @@ -1162,7 +1162,7 @@

Templates

-
template withRow(db: SQLiteral; sql: string; row, body: untyped)
+
template withRow(db: SQLiteral; sql: string; row, body: untyped)

Dynamically prepares and finalizes an sql query.
Name for the resulting prepared statement is given with row parameter.
The code block will be executed only if query returns a row.
For security and performance reasons, this proc should be used with caution.

@@ -1170,7 +1170,7 @@

Templates

-
template withRow(db: SQLiteral; statement: enum; params: varargs[DbValue, toDb];
+
template withRow(db: SQLiteral; statement: enum; params: varargs[DbValue, toDb];
                  row, body: untyped) {.dirty.}
@@ -1179,7 +1179,7 @@

Templates

-
template withRowOr(db: SQLiteral; sql: string; row, body1, body2: untyped)
+
template withRowOr(db: SQLiteral; sql: string; row, body1, body2: untyped)

Dynamically prepares and finalizes an sql query.
Name for the resulting prepared statement is given with row parameter.
First block will be executed if query returns a row, otherwise the second block.
For security and performance reasons, this proc should be used with caution.

Example:

@@ -1191,8 +1191,8 @@

Templates

-
template withRowOr(db: SQLiteral; statement: enum;
-                   params: varargs[DbValue, toDb]; row, body1, body2: untyped)
+
template withRowOr(db: SQLiteral; statement: enum;
+                   params: varargs[DbValue, toDb]; row, body1, body2: untyped)

Executes given statement.
Name for the prepared statement is given with row parameter.
First block will be executed if query returns a row, otherwise the second block.