Error Codes And Messages

Error Codes And Messages

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

The sqlite3_errcode() interface returns the numericresult codeorextended result codefor the most recent Failed sqlite3_* API call associated with adatabase connection. If a prior API call Failed but the most recent API call succeeded,the return value from sqlite3_errcode() is undefined. The sqlite3_extended_errcode() interface is the same except that it always returns theextended result codeeven when extended result codes are disabled.

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.

When the serializedthreading modeis in use,it might be the case that a second error occurs on a separate thread in between the time of the first error and the call to these interfaces. When that happens,the second error will be reported since these interfaces always report the most recent result. To avoid this,each thread can obtain exclusive use of thedatabase connectionD by invokingsqlite3_mutex_enter(sqlite3_db_mutex(D)) before beginning to use D and invokingsqlite3_mutex_leave(sqlite3_db_mutex(D)) after all calls to the interfaces listed here are completed.

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.

相关文章

SQLite架构简单,又有Json计算能力,有时会承担Json文件/RES...
使用Python操作内置数据库SQLite以及MySQL数据库。
破解微信数据库密码,用python导出微信聊天记录
(Unity)SQLite 是一个软件库,实现了自给自足的、无服务器...
安卓开发,利用SQLite实现登陆注册功能