*** 24,26 **** --- 24,55 ---- statements or INSERT statements that take their data from a SELECT, many rows of data are visited and the speed advantage of precompiling is greatly reduced. + + ----- + + 22-July-2003: + + There is now an *experimental* API in SQLite CVS (checkin [1060]) that + can be used for pre-compiled queries: + + sqlite_reset( sqlite_vm *, const char **, sqlite_vm ** ppVm); + + This call is exactly the same as sqlite_finalize() except a new + virtual machine is created and stored in *ppVm. The new virtual + machine is the same as the original was when it was returned + by sqlite_compile() - same query, same callback, same callback + context pointer. So if you need to, you can re-execute the query + without the overhead of going through the parsing and compilation + stage. + + Most real applications will want parameters to pre-compiled queries, + for example to pre-compile "SELECT val FROM values WHERE oid = %1" and + then change the value of %1 for each execution. To simulate this in + SQLite, you could create a function using sqlite_create_function() to + retrieve the query "parameter" from your program. ie. Instead of + "SELECT value FROM values WHERE oid = %1", use + "SELECT value FROM values WHERE oid = get_query_parameter(1)". Or + whatever, you get the idea. + + It would be good if people could post any performance measurements they + make here.