mirror of
https://github.com/logos-storage/nim-datastore.git
synced 2026-01-02 13:43:11 +00:00
change to non-closure iterator
This commit is contained in:
parent
7bb11c0e0b
commit
f0fc8ce224
@ -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]):
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user