设为首页 收藏本站
查看: 917|回复: 0

[经验分享] SQLITE源码剖析(16)

[复制链接]

尚未签到

发表于 2016-11-28 11:26:56 | 显示全部楼层 |阅读模式
  声明:本SQLite源码剖析系列为刘兴(http://deepfuture.iyunv.com/)原创,未经笔者授权,任何人和机构不能转载
 

/*结果代码

** CAPI3REF: Result Codes

** KEYWORDS: SQLITE_OK {error code} {error codes}

** KEYWORDS: {result code} {result codes}

**关键字:SQLITE_OK {error code} {error codes}

**关键字:{result code} {result codes}

** Many SQLite functions return an integer result code from the set shown

** here in order to indicates success or failure.

**新的错误代码可能在未来的SQLite版本中被增加

** New error codes may be added in future versions of SQLite.

**更多可以看[SQLITE_IOERR_READ | extended result codes]

** See also: [SQLITE_IOERR_READ | extended result codes]

*/

//成功返回SQLITE_OK ,即0

#define SQLITE_OK           0   /* Successful result */

/* beginning-of-error-codes */

//SQLITE 错误代码宏

#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   /* NOT USED. Table or record not found */

#define SQLITE_FULL        13   /* Insertion failed because database is full */

#define SQLITE_CANTOPEN    14   /* Unable to open the database file */

#define SQLITE_PROTOCOL    15   /* NOT USED. 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_ROW         100  /* sqlite3_step() has another row ready */

#define SQLITE_DONE        101  /* sqlite3_step() has finished executing */

/* end-of-error-codes */

 

/*

** CAPI3REF: Extended Result Codes

** KEYWORDS: {extended error code} {extended error codes}

** KEYWORDS: {extended result code} {extended result codes}

**扩展返回代码,在默认配置下,SQLITE API返回SQLITE_OK | result codes26总共26个状态整数之一,然而,实践中,这些代码过于粗陋,不能提供太多的问题信息。

** In its default configuration, SQLite API routines return one of 26 integer

** [SQLITE_OK | result codes].  However, experience has shown that many of

** these result codes are too coarse-grained.  They do not provide as

** much information about problems as programmers might like.  In an effort to

** address this, newer versions of SQLite (version 3.3.8 and later) include

** support for additional result codes that provide more detailed information

** about errors. The extended result codes are enabled or disabled

** on a per database connection basis using the

** [sqlite3_extended_result_codes()] API.

**SQLITE的最近新版本(3.3.8及以后)支持额外的返回代码,提供关于错误的更多细节。

使用sqlite3_extended_result_codes()的API在每个数据库连接时允许和禁止额外返回代码。

** Some of the available extended result codes are listed here.

** One may expect the number of extended result codes will be expand

** over time.  Software that uses extended result codes should expect

** to see new result codes in future releases of SQLite.

**下面列出了一些额外返回代码,返回代码随着时间推移越来越多,在未来版本号中将会出现更多的额外返回代码。

** The SQLITE_OK result code will never be extended.  It will always

** be exactly zero.

SQLITE_OK是0,永远不会被扩展和出现更额外的SQLITE_OK

*/

#define SQLITE_IOERR_READ              (SQLITE_IOERR | (1<<8))

#define SQLITE_IOERR_SHORT_READ        (SQLITE_IOERR | (2<<8))

#define SQLITE_IOERR_WRITE             (SQLITE_IOERR | (3<<8))

#define SQLITE_IOERR_FSYNC             (SQLITE_IOERR | (4<<8))

#define SQLITE_IOERR_DIR_FSYNC         (SQLITE_IOERR | (5<<8))

#define SQLITE_IOERR_TRUNCATE          (SQLITE_IOERR | (6<<8))

#define SQLITE_IOERR_FSTAT             (SQLITE_IOERR | (7<<8))

#define SQLITE_IOERR_UNLOCK            (SQLITE_IOERR | (8<<8))

#define SQLITE_IOERR_RDLOCK            (SQLITE_IOERR | (9<<8))

#define SQLITE_IOERR_DELETE            (SQLITE_IOERR | (10<<8))

#define SQLITE_IOERR_BLOCKED           (SQLITE_IOERR | (11<<8))

#define SQLITE_IOERR_NOMEM             (SQLITE_IOERR | (12<<8))

#define SQLITE_IOERR_ACCESS            (SQLITE_IOERR | (13<<8))

#define SQLITE_IOERR_CHECKRESERVEDLOCK (SQLITE_IOERR | (14<<8))

#define SQLITE_IOERR_LOCK              (SQLITE_IOERR | (15<<8))

#define SQLITE_IOERR_CLOSE             (SQLITE_IOERR | (16<<8))

#define SQLITE_IOERR_DIR_CLOSE         (SQLITE_IOERR | (17<<8))

#define SQLITE_LOCKED_SHAREDCACHE      (SQLITE_LOCKED | (1<<8) )

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-306675-1-1.html 上篇帖子: SQLITE源码剖析(9) 下篇帖子: SQLite分页
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表