Back to News
Advertisement
Advertisement

⚡ Community Insights

Discussion Sentiment

50% Positive

Analyzed from 104 words in the discussion.

Trending Topics

#nul#sql#length#function#characters#excluding#cli#omits#character#strings

Discussion (2 Comments)Read Original on HackerNews

Groxx42 minutes ago
>* The length() SQL function only counts characters up to and excluding the first NUL.*

>The quote() SQL function only shows characters up to and excluding the first NUL.

>The .dump command in the CLI omits the first NUL character and all subsequent text in the SQL output that it generates. In fact, the CLI omits everything past the first NUL character in all contexts.

That's just all kinds of "oh no", wow.

I mean, I can't come up with a better strategy, but... oof. C-style strings being a thing at all really hurts.

Scaevolus35 minutes ago
It's not really a big problem. You should be storing arbitrary binary strings as blobs (and length() works properly with them), but the underlying encoding is nearly identical: https://www.sqlite.org/fileformat.html#record_format