Actually, the multiple connections are created from different threads. But
those threads did not access the database in the same moment when the
problem occured, so I assumed (correctly) that the bug happens also when the
connections are done from the same thread. And this is how I created the
script that demonstrated the problem.

Currently the problem is fixed according to the guidelines I got from all of
you. This is how I now step:

Have a prepared statement.
while (true) {
 try to step the prepared statement.
 If failed to step {
    reset the prepared statement to get the correct error.
    if the error is not SQLITE_SCHEMA {
      deal with the error and break from the loop.
    }
    if the error is SQLITE_SCHEMA {
      finalize the prepared statement.
      prepare the statement again.
      continue in the loop (so step again with the newly prepared
statement).
    }
  }
  if the step was successful - break from the loop and continue as usuall
after a successful
  step.
}

I write it here because I could not find an explanation like this in the
documentation (did I miss it somewhere?). Obviously, if anyone still finds
mistakes above, I will be happy if those mistakes are explained.

In addition, I think it might be helpful for others to add the comment that
sqlite3_errmsg() does not return the correct text till sqlite3_reset() or
sqlite3_finalize() are called.

Thanks again,

Ran

On 5/23/06, John Stanton <[EMAIL PROTECTED]> wrote:

Why do you connect twice to the DB?  You then run into synchronization
issues.
JS



Reply via email to