OK, I understand.  Must have miss read teh docs..

thanks,

Scott

Trevor Talbot wrote:
On 8/17/07, Scott Derrick <[EMAIL PROTECTED]> wrote:

exec a "BEGIN IMMEDIATE", with a sleep loop if I can't acquire the
reserved lock.

Then prepare,  step, finalize, exit the function

When I come back into the function and exec a "BEGIN IMMEDIATE" I get an
error

"Cannot start a transaction within a transaction".

Whats wrong?  Doesn't sqlite3_finalize(stmt),  release the locks,
deletes the prepared statement and causes the database to be updated?

It deletes the prepared statement.  The statement's action would have
been performed by a previous sqlite3_step().  Locks and database
updates are another matter, because...

Why does the engine think I'm still in a transaction?

...you started a transaction with BEGIN.  Unless the statement you
stepped is a COMMIT, your transaction isn't done yet :)

Exec a COMMIT at the end of the loop.

Incidentally, you can keep the prepared statement around if it's
appropriate.  You can open the database, prepare the statement, and
only step() and reset() within the loop.  This way you don't have to
keep preparing it over and over again.  You must finalize() it before
closing the database, though.

-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------





--

-
   The most effectual engines for [pacifying a nation] are the public papers... 
[A despotic] government always [keeps] a kind of standing army of newswriters 
who, without any regard to truth or to what should be like truth, [invent] and 
put into the papers whatever might serve the ministers.

   Thomas Jefferson to G. K. van Hogendorp
Oct. 13, 1785. (*) ME 5:181, Papers 8:632

-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to