Small. Fast. Reliable.
Choose any three.

About Sitemap Documentation Download License News Developers Support

## SQLite C Interface

## Closing A Database Connection

>     int sqlite3_close(sqlite3 *);

This routine is the destructor for the sqlite3 object.

Applications should finalize all prepared statements and close all BLOB handles associated with the sqlite3 object prior to attempting to close the object. The sqlite3_next_stmt() interface can be used to locate all prepared statements associated with a database connection if desired. Typical code might look like this:

>     sqlite3_stmt *pStmt;
>     while( (pStmt = sqlite3_next_stmt(db, 0))!=0 ){
>         sqlite3_finalize(pStmt);
>     }

If sqlite3_close() is invoked while a transaction is open, the transaction is automatically rolled back.

The C parameter to sqlite3_close(C) must be either a NULL pointer or an sqlite3 object pointer obtained from sqlite3_open(), sqlite3_open16(), or sqlite3_open_v2(), and not previously closed.

Requirements: H12011 H12012 H12013 H12014 H12015 H12019

See also lists of Objects, Constants, and Functions.