chetana bhargav wrote:
If any one can explain me correctly what sqlite3_prepare does apart from preparing the statement, and does prepare means generating the byte codes necessary.
Chetana,

sqlite3_prepare does nothing other than preparing an SQL statement, and yes, that does include generating the byte codes. It prepares the SQL to be executed by the VDBE engine. The actual execution (interpretation of the byte code) is done by calling sqlite3_step.

sqlite3_prepare takes a SQL statement in the form of a text string and parses it in the context of the current connection and open database(s). It then compiles it to a VDBE byte code program that will implement the SQL statement. This program is called a statement since it implements the meaning of a single SQL statement. These prepared statements can be executed as many times as needed, simply call sqlite3_step (possible multiple times for a query) and then sqlite3_reset to reset the statement so it will execute from the beginning again. Since you may want to vary some of the sub-expressions within the SQL statement between executions, you can include variable parameters in your original SQL statement, and then assign values to those variable before each execution using one of the sqlite3_bind... functions. When you have no further use for the prepared statement you call sqlite3_finalize to release its resources, primarily the memory that holds the byte code program and the values assigned to the variable parameters.

HTH
Dennis Cote

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

Reply via email to