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*);

This group of routines returns information about arguments to a user-defined function. User-defined function implementations use these routines to access their arguments.

The sqlite3_value_type() routine returns one of:

If the result is a BLOB, then the sqlite3_value_blob() routine returns the number of bytes in that BLOB. No type conversions occur. If the result is a string (or a number since a number can be converted into a string), then sqlite3_value_bytes() converts the value into a UTF-8 string and returns the number of bytes in the resulting string. The value returned doesn't include the \000 terminator at the end of the string. The sqlite3_value_bytes16() routine converts the value into a 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 routines 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 automatically. 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