Skip to main content

switch_core_db_bind_text

Function switch_core_db_bind_text 

Source
pub unsafe extern "C" fn switch_core_db_bind_text(
    pStmt: *mut switch_core_db_stmt_t,
    i: c_int,
    zData: *const c_char,
    nData: c_int,
    xDel: switch_core_db_destructor_type_t,
) -> c_int
Expand description

In the SQL strings input to switch_core_db_prepare(), one or more literals can be replace by parameters “?” or “:AAA” or “$VVV” where AAA is an identifer and VVV is a variable name according to the syntax rules of the TCL programming language. The value of these parameters (also called “host parameter names”) can be set using the routines listed below.

In every case, the first parameter is a pointer to the sqlite3_stmt structure returned from switch_core_db_prepare(). The second parameter is the index of the parameter. The first parameter as an index of 1. For named parameters (“:AAA” or “$VVV”) you can use switch_core_db_bind_parameter_index() to get the correct index value given the parameters name. If the same named parameter occurs more than once, it is assigned the same index each time.

The fifth parameter to switch_core_db_bind_blob(), switch_core_db_bind_text(), and switch_core_db_bind_text16() is a destructor used to dispose of the BLOB or text after SQLite has finished with it. If the fifth argument is the special value SQLITE_STATIC, then the library assumes that the information is in static, unmanaged space and does not need to be freed. If the fifth argument has the value SQLITE_TRANSIENT, then SQLite makes its own private copy of the data.

The switch_core_db_bind_* routine must be called before switch_core_db_step() after an switch_core_db_prepare() or sqlite3_reset(). Unbound parameterss are interpreted as NULL.