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.

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.