Mirek Suk <mira....@centrum.cz> wrote: > I just find entire nul handling in SQLite strange. it's C API why not > expect C (that is nul terminated) strings.
Because some people do want to store strings with embedded NULs, for various reasons. If you don't, just pass -1 for length and be done with it. > man says > "Strings returned by sqlite3_column_text() and sqlite3_column_text16(), > even empty strings, are always zero terminated." > "The values returned by sqlite3_column_bytes() > <http://www.sqlite.org/c3ref/column_blob.html> and > sqlite3_column_bytes16() <http://www.sqlite.org/c3ref/column_blob.html> > do not include the zero terminators at the end of the string. For > clarity: the values returned by sqlite3_column_bytes() > <http://www.sqlite.org/c3ref/column_blob.html> and > sqlite3_column_bytes16() <http://www.sqlite.org/c3ref/column_blob.html> > are the number of bytes in the string, not the number of characters." > > If I include my nul does this mean string is my nul terminated or sqlite > appends another one ? SQLite appends another one. > is this auto-added null included in size returned No. But your own (if any) is. > are my nuls removed from string size or not ? No. You get back exactly the sequence of bytes you put in. -- Igor Tandetnik _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users