sqlite3_prepare() and multithreading

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

sqlite3_prepare() and multithreading

Brown, Dave

Is it ok to call sqlite3_prepare() for a statement using the sqlite3 struct
owned by thread A, and then run the actual query with sqlite3_step() and
sqlite3_finalize() using the [different] sqlite3 struct owned by thread B?
(Assume however that both sqlite3 structs were opened to the same database
file).

-Dave
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: sqlite3_prepare() and multithreading

Cory Nelson
sqlite3_step and sqlite3_finalize don't take a sqlite3 struct, so I'm
not sure how you plan to accomplish that.

if you are asking to create a prepared statement in thread A then
process that statement in thread B, I havn't had problems doing that.
Just make sure two threads aren't making calls on the sqlite3 struct
at once.

On 5/21/05, Brown, Dave <[hidden email]> wrote:
>
> Is it ok to call sqlite3_prepare() for a statement using the sqlite3 struct
> owned by thread A, and then run the actual query with sqlite3_step() and
> sqlite3_finalize() using the [different] sqlite3 struct owned by thread B?
> (Assume however that both sqlite3 structs were opened to the same database
> file).
>
> -Dave
>


--
Cory Nelson
http://www.int64.org
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: sqlite3_prepare() and multithreading

Brown, Dave
In reply to this post by Brown, Dave
Right that's what I meant. sqlite3_prepare() using thread A, then step() and
execute() using thread B.

-----Original Message-----
From: Cory Nelson [mailto:[hidden email]]
Sent: Saturday, May 21, 2005 9:15 PM
To: [hidden email]
Subject: Re: [sqlite] sqlite3_prepare() and multithreading

sqlite3_step and sqlite3_finalize don't take a sqlite3 struct, so I'm not
sure how you plan to accomplish that.

if you are asking to create a prepared statement in thread A then process
that statement in thread B, I havn't had problems doing that.
Just make sure two threads aren't making calls on the sqlite3 struct at
once.

On 5/21/05, Brown, Dave <[hidden email]> wrote:

>
> Is it ok to call sqlite3_prepare() for a statement using the sqlite3
> struct owned by thread A, and then run the actual query with
> sqlite3_step() and
> sqlite3_finalize() using the [different] sqlite3 struct owned by thread B?
> (Assume however that both sqlite3 structs were opened to the same
> database file).
>
> -Dave
>


--
Cory Nelson
http://www.int64.org

Loading...