c# 4.0 - problem executing multiple SQLite statements from a single file -


i've been writing thin wrapper around sqlite using p/invoke, , i'd give ability read statements file (for bootstraps, etc.). wrote following in file:

create table test (col1 integer,  col2 text);  insert test (col1, col2) values (1, 'test1'); insert test (col1, col2) values (2, 'test2'); 

this file read via file.readalltext(), prepared via sqlite3_prepare(), , executed via sqlite3_step(). process has prepared , execute single-line sqlite statements.

what happens table created, neither insert statement run. need in order able insert multiple statements in single string?

figured out. turns out sqlite3_step() steps through 1 statement @ time. result, need call sqlite3_step() once each statement in string. gets little involved, since return code sqlite_done returns no matter how many statements you've executed; i'm doing semicolon count before execute string. alternatively, can use sqlite3_exec() if don't want deal looping business.


Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

c# - How to execute a particular part of code asynchronously in a class -