http://www.sqlite.org/c3ref/result_blob.html
I found a documentation typo and have a question about SQLITE_STATIC.
The documentation for sqlite3_result_text says,
"If the 3rd parameter is non-negative, then it must be the byte
offset into the string where the NUL terminator would appear if the
string where NUL terminated."
I believe the intent is subjunctive,
"if the string were NUL terminated".
meaning no NUL is required. It continues:
"If the 4th parameter to the sqlite3_result_text* interfaces or
to sqlite3_result_blob is the special constant SQLITE_STATIC, then
SQLite assumes that the text or BLOB result is in constant space and
does not copy the content...."
My data are static (a read-only mmap'ed file), and the columns are not
null-terminated.
The documentation for the usual column-reading function
sqlite3_column_text() says it always returns a null-terminated string:
"Strings returned by sqlite3_column_text() and
sqlite3_column_text16(), even empty strings, are always
zero-terminated."
According to the above, the user gets a null-terminated string from
static data in a virtual table that is not copied and need not contain a
NUL terminator. That seems unlikely. I would think either a copy is
made or the supplied static data must end in NUL.
If sqlite3_result_text() is provided data with a nonzero length
marked as SQLITE_STATIC, where does the NUL come from that is returned
to the application by sqlite3_column_text()?
--jkl
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users