@@ -446,9 +446,10 @@ proc getParameterIndex*(st: ref Statement, name: string): int =
446
446
if result == 0:
447
447
raise newException(SQLiteError, "Unknown parameter " & name)
448
448
449
+ {.push inline.}
450
+
449
451
proc `[]=`*(st: ref Statement, idx: int , blob: openarray [byte ]) =
450
- st.raw.check_sqlite_stmt sqlite3_bind_blob64(st.raw, idx, blob.unsafeAddr,
451
- blob.len, TransientDestructor)
452
+ st.raw.check_sqlite_stmt sqlite3_bind_blob64(st.raw, idx, blob.unsafeAddr, blob.len, TransientDestructor)
452
453
453
454
proc `[]=`*(st: ref Statement, idx: int , val: SomeFloat) =
454
455
st.raw.check_sqlite_stmt sqlite3_bind_double(st.raw, idx, float64 val)
@@ -465,7 +466,7 @@ proc `[]=`*(st: ref Statement, idx: int, val: string) =
465
466
proc reset*(st: ref Statement) =
466
467
st.raw.check_sqlite_stmt sqlite3_reset(st.raw)
467
468
468
- proc step*(st: ref Statement): bool =
469
+ proc step*(st: ref Statement): bool {.inline.} =
469
470
let res = sqlite3_step(st.raw)
470
471
case res:
471
472
of sr_row: true
@@ -489,12 +490,10 @@ proc getColumn*(st: ref Statement, idx: int, T: typedesc[seq[byte]]): seq[byte]
489
490
result = newSeq[byte ]l
490
491
copyMem(addr result [0 ], p, l)
491
492
492
- proc getColumn* (st: ref Statement, idx: int , T: typedesc [
493
- SomeFloat]) : SomeFloat =
493
+ proc getColumn* (st: ref Statement, idx: int , T: typedesc [SomeFloat]) : SomeFloat =
494
494
cast [T](sqlite3_column_double(st.raw, idx))
495
495
496
- proc getColumn*(st: ref Statement, idx: int , T: typedesc [
497
- SomeOrdinal]): SomeOrdinal =
496
+ proc getColumn*(st: ref Statement, idx: int , T: typedesc [SomeOrdinal]): SomeOrdinal =
498
497
cast[T](sqlite3_column_int64(st.raw, idx))
499
498
500
499
proc getColumn*(st: ref Statement, idx: int , T: typedesc [string ]): string =
@@ -515,6 +514,8 @@ proc unpack*[T: tuple](st: ref Statement, _: typedesc[T]): T =
515
514
value = st.getColumn(idx, type (value))
516
515
idx.inc
517
516
517
+ {.pop.}
518
+
518
519
proc exec*(db: var Database, sql: string ): int {.discardable.} =
519
520
var st = db.fetchStatement(sql)
520
521
defer: st.reset()
0 commit comments