Name

sqlite3_value_xxx() — Get an SQL function parameter

Definition

const void*          sqlite3_value_blob(     sqlite3_value* value );
double               sqlite3_value_double(   sqlite3_value* value );
int                  sqlite3_value_int(      sqlite3_value* value );
sqlite3_int64        sqlite3_value_int64(    sqlite3_value* value );
const unsigned char* sqlite3_value_text(     sqlite3_value* value );
const void*          sqlite3_value_text16(   sqlite3_value* value );
const void*          sqlite3_value_text16le( sqlite3_value* value );
const void*          sqlite3_value_text16be( sqlite3_value* value );
value

An SQL function parameter provided by the SQLite library.

Returns

The extracted value.

Description

These functions are used by an SQL function implementation to extract values from the SQL function parameters. If the requested type is different from the actual underlying value, the value will be converted using the conversion rules defined by Table 7-1.

SQLite takes care of all the memory management for the buffers returned by these functions. Pointers returned will become invalid when the function implementation returns, or if another sqlite3_value_xxx() call is made using the same parameter value.

Be warned that sqlite3_value_int() will clip any integer values to 32 bits. If the SQL function is passed values that cannot be represented by a 32-bit signed integer, it is safer to use sqlite3_column_int64(). The buffer returned by sqlite3_value_text() and sqlite3_value_text16() will always be null-terminated.

In most other regards, these functions are nearly identical ...

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.