On 31 Mar 2010, at 6:39pm, Kevin M. wrote:

>>> So, is there an API or query I can run to load an sql file all in one go 
>>> (one transaction) without having to read in the file manually and query one 
>>> line at a time?
> 
>> No, sorry.  That's what programming languages are for.  Open the file, read 
>> a line, execute it using sqlite3_exec(), read the next line, execute that, 
>> etc..  It shouldn't be much more than a five line loop.  Don't forget to 
>> trap errors.
> 
> Guess I'll adapt some existing code then to wrap all the lines sent in one 
> big transaction.

Just a note that the SQL command files produced by the command-line tool itself 
already have all necessary transaction commands in.  And they have other 
characteristics which may look strange, but actually speed up the execution of 
the SQL commands.  For instance, indices are created after the data is entered 
into the tables.  Where this does have any effect it does lead to smaller 
runtimes.

Simon.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to