Rajan, Vivek K wrote:

I have SQLite schema in an ascii file. I would like to be able to load
this schema via SQLite C-API. How do I do this?



Vivek


What I do is read my schema file into a large string in memory (I use C++ file stream and string stream classes, so this is fairly easy) and then pass that string to sqlite3_exec(). It will execute each SQL statement in the string in turn. It is much faster if the schema file starts with a "begin transaction" statement and ends with a "commit transaction" (what I actually do is execute those statements before and after executing the schema string, also using using sqlite3_exec()).

HTH
Dennis Cote

Reply via email to