On Sat, Feb 27, 2010 at 09:55:07AM +0100, eternelmangekyosharingan scratched on the wall:
> Let's assume you need to insert a small number of rows in a given table > using the C++ API. > Is it recommended to use the one-step query execution interface function > sqlite3_exec over the pre-compiled statement interface functions > sqlite3_prepare_v2, sqlite3_bind_int, ..., sqlite3_step ? Generally the second. Performance is better, and using _bind() is always preferred over building SQL statements with string functions. > Is the second choice always faster than the first one, even for one > insertion ? Not for one... the _exec() function uses _prepare(), _step(), etc., internally, so the performance should be about equal for a single insert. For more than one, _exec() will be slower, but for a basic insert it is unlikely to be much slower. The time differences are trivial next to the disk syncs. If you're doing a small string of inserts (or even a big one) I would suggest wrapping the whole thing in a BEGIN/COMMIT. -j -- Jay A. Kreibich < J A Y @ K R E I B I.C H > "Our opponent is an alien starship packed with atomic bombs. We have a protractor." "I'll go home and see if I can scrounge up a ruler and a piece of string." --from Anathem by Neal Stephenson _______________________________________________ sqlite-users mailing list [email protected] http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

