You mean read it line by line and pass it as const char* to sqlite3_exec? 

Regards
Sachin


-----Original Message-----
From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] 
On Behalf Of Igor Tandetnik
Sent: Tuesday, January 18, 2011 5:52 PM
To: sqlite-users@sqlite.org
Subject: Re: [sqlite] How to execute SQL Query via text/sql file

Sachin Gupta <scgu...@ipolicynetworks.com> wrote:
> We want that the SQLite schema and data be written in a text file. When the 
> application comes up, the SQL file can be executed to
> create the schema and import the data. The text file would have the Create 
> Table statements and also the insert into table
> statements. Similar thing was being done by our application previously. We 
> had a some SQL files and we used to execute these via
> code by creating a command invoking sqlplus and passing the file with a @.  
> 
> I was wondering whether the same could be achieved with SQLite (in Memory).

If the file is reasonably small, just load the whole thing in memory and pass 
it to sqlite3_execute in a single call.
-- 
Igor Tandetnik

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

Reply via email to