On 9/16/17, David Wellman <dwell...@ward-analytics.com> wrote: > > Q1) I believe that the "sqlite3_prepare_v2" function parses the sql text to > check it is valid, the named objects exist etc. and builds the 'executable > program'. Does this function run the SQL? I don't think so. >
sqlite3_prepare_v2() does not run your SQL. Usually. Actually, there are a few PRAGMA statements that do get run immediately. For example "PRAGMA foreign_keys=ON". But for all traditional SQL statements ("INSERT", "DELETE", "UPDATE", "SELECT", "CREATE", "DROP") the SQL is not run until you call sqlite3_step() > > Q2) At what point in the interaction between an application and the SQLite > engine is the sql actually executed? I think this is the first > 'sqlite_step' function call. It *starts* running on the first sqlite3_step() call. But it pauses when the first row of output is generated. Execution continues on the second sqlite3_step() call until another row is ready. And so forth. > > Q3) Are the 'sqlite_prepare' and 'sqlite_step' function calls synchronous? > (By which I mean when called, will they wait to finish their processing > before returning to the application). Yes > > Just out of interest: Is the 'executable program' built by 'prepare' the > 'virtual machine instructions' as referred to on the EXPLAIN documentation > page (http://www.sqlite.org/lang_explain.html )? > Yes -- D. Richard Hipp d...@sqlite.org _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users