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.

Rough order of speed and approximate (guessed) execution time factors

1. using sqlite_prepare etc. will be fastest 2. using sqlite_exec will be slower by 10% to 100% (factor 1.1 to 2) due to time spent generating and reparsing SQL 3. uses system will be slowest by a larger factor (25% to 200%) due to overhead of generating, opening, and reading the SQL from the file.

These factors really depend upon the type of SQL you will be using.

If you are working in C++ you might want to consider using a simple C++ wrapper to handle the prepare, step, finalize sequencing for you. I would suggest http://www.codeproject.com/database/CppSQLite.asp as a good place to start.

HTH
Dennis Cote

Reply via email to