Name

sqlite3_close() — Close a database connection

Definition

int sqlite3_close( sqlite3* db );
db

A database connection. A NULL may be safely passed to this function (resulting in a no-op).

Returns

An SQLite result code.

Description

This function closes a database connection and releases all the resources associated with it. The application is responsible for finalizing all prepared statements and closing all BLOB handles. If the database connection is currently in a transaction, it will be rolled back before the database(s) are closed. All attached databases will automatically be detached.

If an application fails to finalize a prepared statement, the close will fail and SQLITE_BUSY will be returned. The statement must be finalized and sqlite3_close() must be called again.

See Also

sqlite3_open(), sqlite3_finalize(), sqlite3_close(), sqlite3_next_stmt()