On 4/3/06, Matthew Gertner <[EMAIL PROTECTED]> wrote:
> My questions:
> 1) If I am stepping though a statement and change the schema, shouldn't
> the next step() or prepare() return an error requiring me to recreate
> the statement? How come I'm not observing this behavior? Note that none
> of the schema modifications actually effect tables used in the
> above-mentioned tables (otherwise presumably I would get a "table is
> locked" error?). Also, I am running all database operations in a single
> thread, so concurrency should not be an issue.

What kind of locks are you using? If you use the default mechanism
you get conditional locks. It will delay locking the database as much
as possible to increase concurrency.  I think this may be why you're
getting errors where you don't expect them.


> 2) Is it normal that "CREATE TABLE" would return "SQL logic error or
> missing database"? If so, under what circumstances might this occur? I'm
> frankly stumped as to why this occurs at this point. Perhaps I'm
> overlooking something silly, but in any case it would be helpful to have
> an idea of the most common cases that result in this error.
> 3) In general, is there some documentation of how SQLite handles schema
> changes?

You probably want to start the schema change operations with a "begin
immediate".
This tries to establish an exclusive lock immediately. If you get the lock then
your schema change will not fail (since you now have the exclusive right to
modify the database). If you have prepared statements you'll probably
have to re-prepare them after the schema change.

Reply via email to