Name

sqlite3_prepare_xxx() — Convert an SQL string into a prepared statement

Definition

int sqlite3_prepare(      sqlite3* db, const char* sql, int sql_len,
                              sqlite3_stmt** stmt_ref, const char** tail );
int sqlite3_prepare16(    sqlite3* db, const void* sql, int sql_len,
                              sqlite3_stmt** stmt_ref, const char** tail );
int sqlite3_prepare_v2(   sqlite3* db, const char* sql, int sql_len,
                              sqlite3_stmt** stmt_ref, const char** tail );
int sqlite3_prepare16_v2( sqlite3* db, const void* sql, int sql_len,
                              sqlite3_stmt** stmt_ref, const char** tail );
db

A database connection.

sql

One or more SQL statements in a UTF-8 or UTF-16 encoded string. If the string contains more than one SQL statement, the statements must be separated by a semicolon. If the string contains only one SQL statement, no trailing semicolon is required.

sql_len

The length of the sql buffer in bytes. If the sql string is null-terminated, the length should include the termination character. If the sql string is null-terminated but the length is not known, a negative value will cause SQLite to compute the buffer length.

stmt_ref

A reference to a prepared statement. SQLite will allocate and pass back the prepared statement.

tail

If the sql buffer contains more than one SQL statement, only the first complete statement is used. If additional statements exist, this reference will be used to pass back a pointer to the next SQL statement in the sql buffer. This reference may be set to NULL.

Returns

An SQLite result code.

Description

These functions ...

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.