int sqlite3_bind_blob( sqlite3_stmt* stmt, int pidx, const void* val, int bytes, mem_callback ); int sqlite3_bind_double( sqlite3_stmt* stmt, int pidx, double val ); int sqlite3_bind_int( sqlite3_stmt* stmt, int pidx, int val ); int sqlite3_bind_int64( sqlite3_stmt* stmt, int pidx, sqlite3_int64 val ); int sqlite3_bind_null( sqlite3_stmt* stmt, int pidx ); int sqlite3_bind_text( sqlite3_stmt* stmt, int pidx, const char* val, int bytes, mem_callback ); int sqlite3_bind_text16( sqlite3_stmt* stmt, int pidx, const void* val, int bytes, mem_callback ); int sqlite3_bind_value( sqlite3_stmt* stmt, int pidx, const sqlite3_value* val ); int sqlite3_bind_zeroblob( sqlite3_stmt* stmt, int pidx, int bytes ); void mem_callback( void* ptr );
stmt
A prepared statement that contains parameter values.
pidx
The parameter index. The first parameter has
an index of one (1
).
val
The data value to bind
bytes
The size of the data value, in bytes (not
characters). Normally, the length does not include
any null terminator. If val
is a null-terminated string, and
this value is negative, the length will be
automatically computed.
mem_callback
An function pointer to a memory deallocation
function. This function frees the memory buffer
used to hold the value. If the buffer was
allocated with sqlite3_malloc()
, a reference to
sqlite3_free()
can be passed directly.
The special flags SQLITE_STATIC
and SQLITE_TRANSIENT
can
also be used. SQLITE_STATIC
indicates that the
application will keep value memory valid until the
statement is finalized (or a new value is bound).
SQLITE_TRANSIENT
will cause SQLite to
make an internal copy of the value buffer that
will be automatically freed when it is no longer
needed.
sqlite3_bind_xxx()
)An SQLite response code. The code SQLITE_RANGE
will be
returned if the parameter index is invalid.
This family of functions is used to bind a data value to a
statement parameter. Bound values remain in place until the
statement is finalized (via sqlite3_finalize()
) or a new value is bound to
the same parameter index. Resetting the statement via sqlite3_reset()
does not clear
the bindings.
The sqlite3_bind_zeroblob()
function binds a BLOB object of the given length. All the bytes
of the BLOB are set to zero. The BLOB is not actually instanced
in memory, allowing the system to bind very large BLOB values.
These BLOBs can be modified using the sqlite3_blob_xxx()
functions.
For more information on how to include statement parameters in prepared SQL statements, see Bound Parameters.