Ahh thanks a lot for clearing that up I wasn't sure if reset cleared my
actual prepare statement or just the parameters.  So technically at the end
of my loop I can call reset and rebind?

Thanks a lot,
- Jon

-----Original Message-----
From: Igor Tandetnik [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 02, 2007 5:48 PM
To: SQLite
Subject: [sqlite] Re: stmt question

Jonathan Kahn <[EMAIL PROTECTED]>
wrote:
>  If I prepare a statement can I bind variables as my value and then
> set the variables in a loop and execute?  Or in my loop would I bind
> my values and step so each bind gets executed until it equals
> SQLITE_DONE then reset?  I guess I am just unclear on how to execute
> my prepared statement and set my values in a loop.

You have to bind all parameters after sqlite3_prepare or sqlite3_reset 
calls, and before making the first sqlite3_step call. Once you call 
step, you can't change parameters until you call reset. Usually you 
would call step in a loop until it retuns SQLITE_DONE, but it's not 
mandatory (you can stop early). Once you are done processing the 
results, call sqlite_reset to make the statement ready for new 
execution, or call sqlite3_finalize to destroy the statement.

Igor Tandetnik 


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


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

Reply via email to