原文链接:sqlite3.h的常用宏定义,错误代码(SQLITE_OK、SQLITE_BUSY等)-CSDN博客
许多SQLite函数从这里显示的集合中返回一个整数结果代码,以指示成功或失败。
如 sqlite3_open 、sqlite3_get_table、 sqlite3_exec函数的返回值
/*
** CAPI3REF: Result Codes
** KEYWORDS: SQLITE_OK {error code} {error codes}
** KEYWORDS: {result code} {result codes}
**
** Many SQLite functions return an integer result code from the set shown
** here in order to indicate success or failure.
**
** New error codes may be added in future versions of SQLite.
**
** See also: [SQLITE_IOERR_READ | extended result codes],
** [sqlite3_vtab_on_conflict()] [SQLITE_ROLLBACK | result codes].
*/
#define SQLITE_OK 0 /* Successful result */
/* beginning-of-error-codes */
#define SQLITE_ERROR 1 /* SQL error or missing database */
#define SQLITE_INTERNAL 2 /* Internal logic error in SQLite */
#define SQLITE_PERM 3 /* Access permission denied */
#define SQLITE_ABORT 4 /* Callback routine requested an abort */
#define SQLITE_BUSY 5 /* The database file is locked */
#define SQLITE_LOCKED 6 /* A table in the database is locked */
#define SQLITE_NOMEM 7 /* A malloc() failed */
#define SQLITE_READONLY 8 /* Attempt to write a readonly database */
#define SQLITE_INTERRUPT 9 /* Operation terminated by sqlite3_interrupt()*/
#define SQLITE_IOERR 10 /* Some kind of disk I/O error occurred */
#define SQLITE_CORRUPT 11 /* The database disk image is malformed */
#define SQLITE_NOTFOUND 12 /* Unknown opcode in sqlite3_file_control() */
#define SQLITE_FULL 13 /* Insertion failed because database is full */
#define SQLITE_CANTOPEN 14 /* Unable to open the database file */
#define SQLITE_PROTOCOL 15 /* Database lock protocol error */
#define SQLITE_EMPTY 16 /* Database is empty */
#define SQLITE_SCHEMA 17 /* The database schema changed */
#define SQLITE_TOOBIG 18 /* String or BLOB exceeds size limit */
#define SQLITE_CONSTRAINT 19 /* Abort due to constraint violation */
#define SQLITE_MISMATCH 20 /* Data type mismatch */
#define SQLITE_MISUSE 21 /* Library used incorrectly */
#define SQLITE_NOLFS 22 /* Uses OS features not supported on host */
#define SQLITE_AUTH 23 /* Authorization denied */
#define SQLITE_FORMAT 24 /* Auxiliary database format error */
#define SQLITE_RANGE 25 /* 2nd parameter to sqlite3_bind out of range */
#define SQLITE_NOTADB 26 /* File opened that is not a database file */
#define SQLITE_NOTICE 27 /* Notifications from sqlite3_log() */
#define SQLITE_WARNING 28 /* Warnings from sqlite3_log() */
#define SQLITE_ROW 100 /* sqlite3_step() has another row ready */
#define SQLITE_DONE 101 /* sqlite3_step() has finished executing */
/* end-of-error-codes */
翻译
#define SQLITE_OK 0 /*成功结果*/
#define SQLITE_ERROR 1 /*SQL错误或缺少数据库*/
#define SQLITE_INTERNAL 2 /*SQLite中的内部逻辑错误*/
#define SQLITE_PERM 3 /*访问权限被拒绝*/
#define SQLITE_ABORT 4 /*回调例程请求中止*/
#define SQLITE_BUSY 5 /*数据库文件已锁定*/
#define SQLITE_LOCKED 6 /*数据库中的一个表被锁定*/
#define SQLITE_NOMEM 7 /*一个malloc()失败*/
#define SQLITE_READONLY 8 /*尝试写入只读数据库*/
#define SQLITE_INTERRUPT 9 /*由sqlite3_interrupt()终止的操作*/
#define SQLITE_IOERR 10 /*发生某种磁盘I/O错误*/
#define SQLITE_CORRUPT 11 /*数据库磁盘映像格式不正确*/
#define SQLITE_NOTFOUND 12 /*未知操作码sqlite3_interrupt()*/
#define SQLITE_FULL 13 /*插入失败,因为数据库已满*/
#define SQLITE_CANTOPEN 14 /*无法打开数据库文件*/
#define SQLITE_PROTOCOL 15 /*数据库锁协议错误*/
#define SQLITE_EMPTY 16 /*数据库为空*/
#define SQLITE_SCHEMA 17 /*数据库架构已更改*/
#define SQLITE_TOOBIG 18 /*字符串或BLOB超出大小限制*/
#define SQLITE_CONSTRAINT 19 /*由于约束冲突而中止*/
#define SQLITE_MISMATCH 20 /*数据类型不匹配*/
#define SQLITE_usage 21 /*库使用错误*/
#define SQLITE_NOLFS 22 /*使用主机不支持的操作系统功能*/
#define SQLITE_AUTH 23 /*授权被拒绝*/
#define SQLITE_FORMAT 24 /*辅助数据库格式错误*/
#define SQLITE_RANGE 25 /*第二个参数定义为sqlite3_bind超出范围*/
#define SQLITE_NOTADB 26 /*打开的不是数据库文件的文件*/
#define SQLITE_NOTICE 27 /*来自sqlite3_log()的通知*/
#define SQLITE_WARNING 28 /*来自sqlite3_log()的警告*/
#define SQLITE_ROW 100 /*sqlite3_step()已准备好另一行*/
#define SQLITE_DONE 101 /*sqlite3_step()已完成执行*/