Small. Fast. Reliable.
Choose any three.

SQLite C Interface

Error Codes And Messages

int sqlite3_errcode(sqlite3 *db);
const char *sqlite3_errmsg(sqlite3*);
const void *sqlite3_errmsg16(sqlite3*);

The sqlite3_errcode() interface returns the numeric result code or extended result code for the most recent failed sqlite3_* API call associated with a database connection. If a prior API call failed but the most recent API call succeeded, the return value from sqlite3_errcode() is undefined.

The sqlite3_errmsg() and sqlite3_errmsg16() return English-language text that describes the error, as either UTF-8 or UTF-16 respectively. Memory to hold the error message string is managed internally. The application does not need to worry about freeing the result. However, the error string might be overwritten or deallocated by subsequent calls to other SQLite interface functions.

If an interface fails with SQLITE_MISUSE, that means the interface was invoked incorrectly by the application. In that case, the error code and message may or may not be set.

Invariants:

H12801 The sqlite3_errcode(D) interface returns the numeric result code or extended result code for the most recently failed interface call associated with the database connection D.
H12803 The sqlite3_errmsg(D) and sqlite3_errmsg16(D) interfaces return English-language text that describes the error in the mostly recently failed interface call, encoded as either UTF-8 or UTF-16 respectively.
H12807 The strings returned by sqlite3_errmsg() and sqlite3_errmsg16() are valid until the next SQLite interface call.
H12808 Calls to API routines that do not return an error code (example: sqlite3_data_count()) do not change the error code or message returned by sqlite3_errcode(), sqlite3_errmsg(), or sqlite3_errmsg16().
H12809 Interfaces that are not associated with a specific database connection (examples: sqlite3_mprintf() or sqlite3_enable_shared_cache() do not change the values returned by sqlite3_errcode(), sqlite3_errmsg(), or sqlite3_errmsg16().

See also lists of Objects, Constants, and Functions.


This page last modified 2008/08/11 17:57:43 UTC