If your application runs the same SQL statements more than once, use
prepare, but this way
sqlite3_prepare
...
multiple
sqlite3_step
sqlite3_reset
at the end
sqlite3_finalize
Sqlite3_exec is just a wrapper around prepare, step, reset... Use it if
you are only executing the SQL once.
The last approach is ugly.
Deepak Kaul wrote:
Please rank the following scenarios considering speed, locks and
stability. I'm using sqlite in a C++ environment and running in a
single process and single threaded environment where SQL_BUSY should
occur minimally.
1. Calling sqlite_exec within my C++ program
2. Calling sqlite_prepare, sqlite3_step and sqlite3_finalize within my
C++ program
3. Calling ::system with the following string "/usr/bin/sqlite3
database.db < file.txt"
Where file.txt contains ".read sqlstatements.txt"
Where sqlstatements.txt contains sql statements to be executed.
Thanks in advance.