Mira Suk <mira....@centrum.cz> wrote:
> On 9/21/2011 21:22 Igor Tandetnik wrote:
> 
>> You can include the NUL terminator, if you want it to actually be stored
>> in the database.
> 
> Actually you can't - if you do all SQL string functions will not work.
> to be clear -
> SELECT TRIM(what ever text column you stored with including null on end of 
> string)
> will not trim that string.

It does work - it removes all whitespace from the end of the string, up to but 
not including the first non-whitespace character. Which happens to be NUL. It 
follows the spec perfectly, it's your expectations that are wrong.

Note that I didn't say it was wise to store NUL characters as part of the 
string - I only said that you could do it if you wanted to. sqlite3_bind_text 
takes the length parameter at face value, and stores exactly as many bytes as 
you tell it to store. It's up to you to ensure that the values actually make 
sense for your application. Garbage in/garbage out and all that.
-- 
Igor Tandetnik

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to