mirror of
https://github.com/logos-messaging/logos-messaging-nim.git
synced 2026-01-08 00:43:06 +00:00
fix(archive): patch the sqlite driver to solve results inconsistencies
This commit is contained in:
parent
43fd11b4dc
commit
41b2f87f68
@ -127,10 +127,15 @@ template prepare*(env: Sqlite, q: string, cleanup: untyped): ptr sqlite3_stmt =
|
||||
|
||||
proc bindParam*(s: RawStmtPtr, n: int, val: auto): cint =
|
||||
when val is openarray[byte]|seq[byte]:
|
||||
# The constant, SQLITE_TRANSIENT, may be passed to indicate that the object is to be copied
|
||||
# prior to the return from sqlite3_bind_*(). The object and pointer to it must remain valid
|
||||
# until then. SQLite will then manage the lifetime of its private copy.
|
||||
#
|
||||
# From: https://www.sqlite.org/c3ref/bind_blob.html
|
||||
if val.len > 0:
|
||||
sqlite3_bind_blob(s, n.cint, unsafeAddr val[0], val.len.cint, nil)
|
||||
sqlite3_bind_blob(s, n.cint, unsafeAddr val[0], val.len.cint, SQLITE_TRANSIENT)
|
||||
else:
|
||||
sqlite3_bind_blob(s, n.cint, nil, 0.cint, nil)
|
||||
sqlite3_bind_blob(s, n.cint, nil, 0.cint, SQLITE_TRANSIENT)
|
||||
elif val is int32:
|
||||
sqlite3_bind_int(s, n.cint, val)
|
||||
elif val is uint32:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user