Name

sqlite3_value_bytes() — Get the size of an SQL function parameter

Definition

int sqlite3_value_bytes(   sqlite3_value* value );
int sqlite3_value_bytes16( sqlite3_value* value );
value

An SQL function parameter value.

Returns

The number of bytes in the SQL function parameter 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_value_xxx()), so care must be taken to call them in conjunction with the appropriate sqlite3_value_xxx() function.

To avoid problems, an application should first extract the desired type using an sqlite3_value_xxx() function, and then call the appropriate sqlite3_value_bytes() function. The functions sqlite3_value_text() and sqlite3_value_blob() should be followed by a call to sqlite3_value_bytes(), while any call to an sqlite3_value_text16xxx() should be followed by a call to sqlite3_value_bytes16().

If these functions are called for 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.

In most other regards, these functions are nearly identical to the sqlite3_column_bytes() functions.

Get Using SQLite now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.