On 6 Dec 2015, at 8:46pm, Lars Fiedler <lhfiedler at gmail.com> wrote:

> Is it possible with certain settings to have a dbdatareader iterating through 
> rows, and at the same time create a new table?  I've tried various settings - 
> read uncommitted, wal mode, shared cache.  But it looks like the open reader 
> has a read lock on sqlite_master (not read uncommitted), and the create table 
> command wants a write lock on sqlite_master.

I'm tempted to tell you that even if it were possible you shouldn't do it.

SQLite's API has separate _step() calls because a SELECT could return millions 
of rows and you might not have enough memory to store them all.  Because you 
(the programmer) have the opportunity to wait as long as you want between 
_step()s you might want to consider them separate operations.  But they're not 
really, and you should really get them out the way, all the way to _finalize() 
or _reset(), before you consider doing other things.

One solution you might be able to use is to build up a sequence of SQL commands 
in a long string (separated by semi-colons, of course).  Then once you've 
_finalize()d your SELECT you can just _exec() the string.

Simon.

Reply via email to