Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Empty blobs as bind parameters being returned as NULLs #168

Closed
msfstef opened this issue Apr 9, 2024 · 2 comments
Closed

Empty blobs as bind parameters being returned as NULLs #168

msfstef opened this issue Apr 9, 2024 · 2 comments

Comments

@msfstef
Copy link

msfstef commented Apr 9, 2024

Currently empty blobs can be written and read unless they are inserted as bind parameters, in which case they get returned as null. Issue seems to be that nothing gets allocated for them and are interpreted as NULLs.

PR with suggested fix: #167

@sgbeal
Copy link

sgbeal commented Apr 9, 2024

That's how the C library works: https://sqlite.org/c3ref/column_blob.html returns a C NULL for length-zero blobs, and C NULL is interpreted as SQL NULL except in cases where a C NULL is interpreted as an allocation error.

@rhashimoto
Copy link
Owner

There's additional relevant discussion in the PR. Summary: this behavior by the C library is less than ideal but altering that behavior in a wrapper API is also not ideal. There's no everyone wins solution here, unfortunately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants