On Apr 10, 2010, at 1:51 AM, Adam DeVita wrote: > Is this a 1 off import? If so, perhaps the command line tool > can .read it. > > On Fri, Apr 9, 2010 at 2:13 PM, Shaun Seckman (Firaxis) < > shaun.seck...@firaxis.com> wrote: > >> Greetings, >> >> I've got a .SQL file that contains multiple SQL insert statements for >> various tables as well as comments embedded throughout. When I >> attempted to pass the file into sqlite3_exec, I found that only the >> first SQL command was getting executed.
That should not be the case. sqlite3_exec() should execute the whole script. >> What is the best way to ensure >> that all commands are executed? Parsing the file line-by-line is >> inaccurate as multiple statements may be on the same line and looking >> for the next ';' character has parsing problems as well. >> >> >> >> The documents state that sqlite3_complete() only returns a 1 if the >> statement is complete. Were this method to return the index into the >> character array to denote WHERE the SQL statement is complete, I >> could >> use that to parse multiple statements. >> >> >> >> Does anyone have any suggestions? See also the 5th parameter to sqlite3_prepare_v2(). This API allows you to compile the first statement in an SQL script and returns a pointer to the start of the next statement in the script at the same time. http://www.sqlite.org/c3ref/prepare.html Dan. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users