sqlite3_value_*

const void *sqlite3_value_blob(sqlite3_value*);
    
int sqlite3_value_bytes(sqlite3_value*);
    
int sqlite3_value_bytes16(sqlite3_value*);

double sqlite3_value_double(sqlite3_value*);

int sqlite3_value_int(sqlite3_value*);

long long int sqlite3_value_int64(sqlite3_value*);

const unsigned char *sqlite3_value_text(sqlite3_value*);

const void *sqlite3_value_text16(sqlite3_value*);

const void *sqlite3_value_text16be(sqlite3_value*);

const void *sqlite3_value_text16le(sqlite3_value*);

int sqlite3_value_type(sqlite3_value*);

These API functions allow user-defined functions to access input data passed in by arguments.

The sqlite3_value_type() function returns one of:

If the result is a BLOB, then the sqlite3_value_blob() function returns the number of bytes in that BLOB. No type conversions occur. If the result is a string (or a number, which can be converted into a string), then sqlite3_value_bytes() converts the value into UTF-8 encoding and returns the number of bytes in the resulting string. The value returned doesn't include the \000 terminator at the end. The sqlite3_value_bytes16() function converts the value into UTF-16 encoding and returns the number of bytes (not characters) in the resulting string. The \u0000 terminator is not included in this count.

These SQLite API functions attempt to convert the value where appropriate. For example, if the internal representation is FLOAT and a text result is requested, sprintf() is used internally to do the conversion. The following table details the conversions that are applied:

Internal Type Requested Type Conversion
NULL INTEGER Result is 0
NULL FLOAT Result is 0.0
NULL TEXT Result is NULL pointer
NULL BLOB Result is NULL pointer
INTEGER FLOAT Convert from integer to float
INTEGER TEXT ASCII rendering of the integer
INTEGER BLOB Same as for INTEGER to TEXT
FLOAT INTEGER Convert from float to integer
FLOAT TEXT ASCII rendering of the float
FLOAT BLOB Same as FLOAT to TEXT
TEXT INTEGER Use atoi()
TEXT FLOAT Use atof()
TEXT BLOB No change
BLOB INTEGER Convert to TEXT, then use atoi()
BLOB FLOAT Convert to TEXT, then use atof()
BLOB TEXT Add a \000 terminator if needed