#94 datastore_sqlite.c:db_loop error handling

closed-fixed
nobody
None
5
2006-01-02
2005-12-17
Sami Farin
No

if hook == NULL, sqlite3_step loop does not modify rc,
so it's always 0.
if sqlite3_step returns some other value than
SQLITE_ROW or SQLITE_DONE, default switch returns rc (0).
so, in db_open it executes COMMIT instead of barfing on
error.

Discussion

  • David Relson
    David Relson
    2005-12-19

    Logged In: YES
    user_id=30510

    Good analysis! Setting rc to the value of sqlite3_step
    should fix the problem, no? Let me know what you think of
    the patch below.

    David

    --- datastore_sqlite.c 25 Sep 2005 14:52:08 -0000 1.44
    +++ datastore_sqlite.c 19 Dec 2005 01:19:29 -0000
    @@ -197,7 +197,8 @@
    }
    loop = true;
    while (loop) {
    - switch (sqlite3_step(stmt)) {
    + rc = sqlite3_step(stmt);
    + switch (rc) {
    case SQLITE_ROW:
    found = true;
    if (hook != NULL)

     
  • David Relson
    David Relson
    2005-12-19

    • status: open --> closed
     
    • status: closed --> closed-fixed