Kervin L. Pierre wrote:
and for performance, I would like to execute as
few sqlite_exec() calls as possible.


Kervin,

While you can pass several SQL statements to sqlite3_exec in one sql string, each statement is compiled and executed separately, so the performance increase over separate calls to sqlite3_exec is not substantial. If you add 1000 inserts into a string and pass that to sqlite3_exec, it will repeat the following steps 1000 times; parse insert statement sql, generate insert statement, execute insert statement, and destroy insert statement.

However, if you use a prepared statement, and then simply bind new values to it for each insert you eliminate the parse, generate, and destroy steps for 999 out of the 1000 statements. This will provide a much more substantial performance boost.

Note, it is also extremely important to wrap your block of inserts with "begin transaction" and "end transaction" commands.

HTH
Dennis Cote


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

Reply via email to