sqlite3 uses sqlite3_exec, whose prototype is as follows:
C
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 */
);One of the parameters is of type callback. The queried data is handled inside the callback.
I've always been used to the convention that 0 means false and anything non-zero means true. So, following that habit, I returned 1 to mean true.
At first, everything worked perfectly: creating tables, inserting data, querying a result set with just one row — until one day, I queried three rows... and got error code (4) (error code list).
It said:
Callback routine requested an abortWTF — judging by the name, did my query go wrong?
I debugged the query every which way. Then, one time, just on a whim, I set the callback function's return value to 0 — and it passed.
..............................
Comments · 1