Hello Simon,

I actually never finalize prepared statements until the DB is closed and not 
being used anymore.  I reset the prepared statements.  For writes (inserts, 
updates, etc.) I use explicit transactions with commits (or rollbacks if 
errors).  I reuse the prepared statements by rebinding parameters (always 
changing anyway).  My understanding is you finalize a prepared statement when 
you know you will not use it anymore to free up resources.  My application uses 
the prepared statements until the DB is shutdown.  Is that not proper?  Please 
enlighten me if this is not what I should be doing.

Thanks,

John

--- On Thu, 5/12/11, Simon Slavin <slav...@bigfraud.org> wrote:

> From: Simon Slavin <slav...@bigfraud.org>
> Subject: Re: [sqlite] Common Multi-treaded Problem
> To: "General Discussion of SQLite Database" <sqlite-users@sqlite.org>
> Date: Thursday, May 12, 2011, 9:28 PM
> 
> On 13 May 2011, at 1:33am, John Deal wrote:
> 
> > Humm.  Resetting each prepared statement right
> after use seemed to work.  So in review, a select
> prepared statement will lock the DB from other threads (or
> is it DB connections?) but not the current thread (or is it
> DB connection).
> 
> I don't think it's meant to work like that.  Are you
> getting errors when you call _finalize() ?
> 
> <http://www.sqlite.org/c3ref/finalize.html>
> 
> Simon.
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> 
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to