Ran <[EMAIL PROTECTED]> wrote:
> 
>   rc = sqlite3_step(pStmt3);
>   if (rc != SQLITE_DONE) { // if we failed, we log it.
>     printf("Failed to step statement: %s\n", sqlite3_errmsg(db1));
>   }

The sqlite3_errmsg() API does not return the correct error
message text until after you do sqlite3_reset() or
sqlite3_finalize().  So if you change the above to read:

    rc = sqlite3_step(pStmt3);
    if (rc != SQLITE_DONE) { // if we failed, we show it.
      sqlite3_reset(pStmt3);  // <<<< This line inserted
      printf("Failed to step statement: %s\n", sqlite3_errmsg(db1));
    }

Then the program will give you the correct error message:

   "database schema has changed"

Finalize your statement and rebuild it by a second call to
sqlite3_prepare() and it should work.
--
D. Richard Hipp   <[EMAIL PROTECTED]>

Reply via email to