This prints valid=1, and loading the key gives you "thekey".
However, if it's an on-disk database instead (unqlite_open(&pDb, "some_file.tmp", UNQLITE_OPEN_CREATE)), then the initial cursor is not valid, and points to no element.
I think the behavior should be consistent, and in both cases the cursor should start off invalid. Either that, or specify explicitly in the docs that a just-initialized cursor may be either valid or invalid, and to get an invalid cursor on purpose you have to do something like:
When using an in-memory database, a just-initialized cursor is valid:
This prints
valid=1
, and loading the key gives you"thekey"
.However, if it's an on-disk database instead (
unqlite_open(&pDb, "some_file.tmp", UNQLITE_OPEN_CREATE)
), then the initial cursor is not valid, and points to no element.I think the behavior should be consistent, and in both cases the cursor should start off invalid. Either that, or specify explicitly in the docs that a just-initialized cursor may be either valid or invalid, and to get an invalid cursor on purpose you have to do something like:
(Note this may not even work, see #29).