vrischmann / zig-sqlite

zig-sqlite is a small wrapper around sqlite's C API, making it easier to use with Zig.
MIT License
367 stars 49 forks source link

empty slice bound to null #68

Closed vrischmann closed 2 years ago

vrischmann commented 2 years ago

in a text field, &[_]T{} seems to be bound to null by sqlite instead of an empty string.

need to investigate and see if it actually is a bug.

vrischmann commented 2 years ago

Ok so if I have a slice &[_]u8{} its ptr field is actually 0, aka NULL and sqlite actually does a sqlite3_bind_null instead (see the sqlite3_bind_text documentation).

That seems fine to me because when reading a NULL column we always create an empty string so that behaviour should be transparent for the user.

I did find a bug with readArray while looking into this.

@nektro to me things are working correctly, can you clarify what the actual bug was that you encountered ?