Name
sqlite3_column_bytes() — Get the size of a column buffer
Definition
int sqlite3_column_bytes( sqlite3_stmt* stmt, int cidx ); int sqlite3_column_bytes16( sqlite3_stmt* stmt, int cidx );
-
stmt A prepared and executed statement.
-
cidx A column index. The first column has an index of zero (
0).- Returns
The number of bytes in the column value.
Description
These functions return the number of bytes in a text or BLOB
value. Calling these functions can cause a type conversion
(invalidating buffers returned by sqlite3_column_xxx()), so care must be taken to
call them in conjunction with the appropriate sqlite3_column_xxx()
function.
To avoid problems, an application should first extract the
desired type using a sqlite3_column_xxx() function, and then call
the appropriate sqlite3_column_bytes() function. The functions
sqlite3_column_text()
and sqlite3_column_blob()
should be followed by a call to sqlite3_column_bytes(), while any call to
sqlite3_column_text16()
should be followed by a call to sqlite3_column_bytes16().
If these functions are called on a non-text or non-BLOB value, the value will first be converted to an appropriately encoded text value, then the length of that text value will be returned.
See Also
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access