From 8fe5e3df057bb96be23396cd2f5c270c7695f893 Mon Sep 17 00:00:00 2001 From: Jaremy Creechley Date: Wed, 20 Sep 2023 23:36:20 -0700 Subject: [PATCH] key batch --- datastore/sql/sqliteutils.nim | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/datastore/sql/sqliteutils.nim b/datastore/sql/sqliteutils.nim index dab5b81..a235eb6 100644 --- a/datastore/sql/sqliteutils.nim +++ b/datastore/sql/sqliteutils.nim @@ -69,13 +69,9 @@ proc bindParam( # 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." - sqlite3_bind_text(s, n.cint, val.cstring, -1.cint, SQLITE_TRANSIENT) + sqlite3_bind_text(s, n.cint, val.cstring, val.len().cint, SQLITE_TRANSIENT) elif val is KeyId: - # `-1` implies string length is num bytes up to first null-terminator; - # `SQLITE_TRANSIENT` "indicate[s] 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." + # same as previous sqlite3_bind_text(s, n.cint, val.toCString(), val.data.len().cint, SQLITE_TRANSIENT) else: {.fatal: "Please add support for the '" & $typeof(val) & "' type".}