Small. Fast. Reliable.
Choose any three.

SQLite C Interface

Closing A Database Connection

int sqlite3_close(sqlite3 *);

The sqlite3_close() interfaces destroys an sqlite3 object allocated by a prior call to sqlite3_open(), sqlite3_open16(), or sqlite3_open_v2(). Sqlite3_close() releases all memory used by the connection and closes all open files..

If the database connection contains prepared statements that have not been finalized by sqlite3_finalize(), then sqlite3_close() returns SQLITE_BUSY and leaves the connection open. Giving sqlite3_close() a NULL pointer is a harmless no-op.

Passing this routine a database connection that has already been closed results in undefined behavior. If other interfaces that reference the same database connection are pending (either in the same thread or in different threads) when this routine is called, then the behavior is undefined and is almost certainly undesirable.

See also lists of Objects, Constants, and Functions.


This page last modified 2007/12/14 14:37:57 UTC