Bind array values to the CARRAY table-valued function

Small. Fast. Reliable.
Choose any three.

## SQLite C Interface

## Bind array values to the CARRAY table-valued function

>     int sqlite3_carray_bind_v2(
>       sqlite3_stmt *pStmt,        /* Statement to be bound */
>       int i,                      /* Parameter index */
>       void *aData,                /* Pointer to array data */
>       int nData,                  /* Number of data elements */
>       int mFlags,                 /* CARRAY flags */
>       void (*xDel)(void*),        /* Destructor for aData */
>       void *pDel                  /* Optional argument to xDel() */
>     );
>     int sqlite3_carray_bind(
>       sqlite3_stmt *pStmt,        /* Statement to be bound */
>       int i,                      /* Parameter index */
>       void *aData,                /* Pointer to array data */
>       int nData,                  /* Number of data elements */
>       int mFlags,                 /* CARRAY flags */
>       void (*xDel)(void*)         /* Destructor for aData */
>     );

The sqlite3_carray_bind_v2(S,I,P,N,F,X,D) interface binds an array value to parameter that is the first argument of the carray() table-valued function. The S parameter is a pointer to the prepared statement that uses the carray() functions. I is the parameter index to be bound. I must be the index of the parameter that is the first argument to the carray() table-valued function. P is a pointer to the array to be bound, and N is the number of elements in the array. The F argument is one of constants SQLITE_CARRAY_INT32, SQLITE_CARRAY_INT64, SQLITE_CARRAY_DOUBLE, SQLITE_CARRAY_TEXT, or SQLITE_CARRAY_BLOB to indicate the datatype of the array P.

If the X argument is not a NULL pointer or one of the special values SQLITE_STATIC or SQLITE_TRANSIENT, then SQLite will invoke the function X with argument D when it is finished using the data in P. The call to X(D) is a destructor for the array P. The destructor X(D) is invoked even if the call to sqlite3_carray_bind_v2() fails. If the X parameter is the special-case value SQLITE_STATIC, then SQLite assumes that the data static and the destructor is never invoked. If the X parameter is the special-case value SQLITE_TRANSIENT, then sqlite3_carray_bind_v2() makes its own private copy of the data prior to returning and never invokes the destructor X.

The sqlite3_carray_bind() function works the same as sqlite3_carray_bind_v2() with a D parameter set to P. In other words, sqlite3_carray_bind(S,I,P,N,F,X) is same as sqlite3_carray_bind_v2(S,I,P,N,F,X,P).

See also lists of Objects, Constants, and Functions.