change to non-closure iterator

This commit is contained in:
Jaremy Creechley 2023-09-25 16:08:59 -07:00
parent 7bb11c0e0b
commit f0fc8ce224
No known key found for this signature in database
GPG Key ID: 4E66FB67B21D3300
3 changed files with 6 additions and 13 deletions

View File

@ -195,6 +195,7 @@ iterator iter*(handle: var DbQueryHandle[RawStmtPtr]): ?!DbQueryResponse =
# error it is necessary to check that the result is a null pointer and
# that the result code is an error code
if blob.isSome and blob.get().isNil:
echo "BLOB: isSome"
let v = sqlite3_errcode(sqlite3_db_handle(handle.env))
if not (v in [SQLITE_OK, SQLITE_ROW, SQLITE_DONE]):

View File

@ -116,19 +116,11 @@ proc `$`*(data: DataBuffer): string =
data.toString()
proc `==`*(a, b: DataBuffer): bool =
echo "DB == ", a.toString, " ", b.toString
echo "DB == len: ", a.len, " ", b.len
echo "DB == size: ", a[].size, " ", b[].size
echo "DB == cap: ", a[].cap, " ", b[].cap
echo "DB == ", a[].buf.pointer.repr, " ", b[].buf.pointer.repr
echo "DB == ", a.hash, " ", b.hash
if a.isNil and b.isNil: result = true
elif a.isNil or b.isNil: result = false
elif a[].size != b[].size: result = false
elif a[].buf == b[].buf: result = true
else: result = a.hash() == b.hash()
echo "DB == ", result
echo ""
converter toBuffer*(err: ref CatchableError): DataBuffer =
## convert exception to an object with StringBuffer

View File

@ -123,7 +123,7 @@ suite "queryTests":
test "Key should query all keys and all it's children":
let
q = DbQuery(key: key1)
q = DbQuery(key: key1, value: true)
ds.put(key1, val1).tryGet
ds.put(key2, val2).tryGet
@ -142,11 +142,11 @@ suite "queryTests":
res[0].key.get == key1
res[0].data == val1
# res[1].key.get == key2
# res[1].data == val2
res[1].key.get == key2
res[1].data == val2
# res[2].key.get == key3
# res[2].data == val3
res[2].key.get == key3
res[2].data == val3
# test "Key should query all keys without values":
# let