Name

sqlite3_next_stmt() — Step through a list of prepared statements

Definition

sqlite3_stmt* sqlite3_next_stmt( sqlite3* db, sqlite3_stmt* stmt );
db

A database connection.

stmt

The previous statement. To get the first statement, pass in a NULL.

Returns

A prepared statement pointer. A NULL indicates the end of the list.

Description

This function iterates over the list of prepared statements associated with the given database connection. Passing in a NULL statement pointer will return the first statement. Subsequent statements can be retrieved by passing back the last returned statement value.

If an application is iterating over prepared statements and finalizing them, remember that the sqlite3_finalize() function will remove the statement from the statement list. In such cases, the application should keep passing in a NULL statement value until no more statements remain. This technique is not recommended, however, as it can leave dangling statement pointers.

See Also

sqlite3_prepare_xxx(), sqlite3_finalize()