sqlite3使用sqlite3_exec,原型如下:

int sqlite3_exec(
    sqlite3*,                                  /* An open database */
    const char *sql,                           /* SQL to be evaluated */
    int (*callback)(void*,int,char**,char**),  /* Callback function */
    void *,                                    /* 1st argument to callback */
    char **errmsg                              /* Error msg written here */
);

其中有个参数是callback类型的。查询到的数据放在callback中处理。

一直以来,习惯使用 0为false,!0为true 这次也按照习惯,返回一个1为真

开始完全没有问题,建立表,插入数据,查询只有1条的数据 -- 直到有一次,查询3条数据。。然后返回错误码(4)(错误码列表) 说是

 Callback routine requested an abort

我了个去 -- 顾名思义,望文生意,query错了? 各种debug query,直到有一次,试试看的心理把被callback的函数返回值设为 0 -- 过了

。。。。。。。。。。。。。。。。。。。。。

Categories: Code

Yu

Ideals are like the stars: we never reach them, but like the mariners of the sea, we chart our course by them.

1 Comment

Leniy · April 14, 2013 at 08:01

Google Chrome 26.0.1410.64 Google Chrome 26.0.1410.64 Windows 7 Windows 7

果然好囧的问题

Leave a Reply to Leniy Cancel reply

Your email address will not be published. Required fields are marked *