Paul Tomblin <[EMAIL PROTECTED]> wrote:
> Quoting Dan Kennedy ([EMAIL PROTECTED]):
> > > - The second problem appears to be a problem with self-locking.  I'm
> > >   inserting a "mapping" into a table.  I have a query active to find ids
> > >   that require mapping, and then I try to find the current lowest
> > >   unused "mapping" value, and insert it.
> > 
> > Right. You can't modify a table that is currently being scanned by
> > a SELECT query. One way around this is to make a copy of the table
> > in a TEMP table for the duration of the operation.
> 
> But actually I'm not currently selecting from it.  I prepare two
> statements, one for query and one for insert.  The query should only
> return 0 or 1 rows.  I do the query, then if it returns 0 rows, I do the
> insert.  I repeat this multiple times, using the same prepared statements
> each time. 

Call sqlite3_reset() on the query before doing the insert.
--
D. Richard Hipp <[EMAIL PROTECTED]>

Reply via email to