On Apr 22, 2008, at 7:57 PM, Joanne Pham joannekpham-at-yahoo.com | sqlite| wrote:
> Hi all, > I have the serveral sql statement in the one file call : getData.sql > and > I want to use the sqlite API to call this file to execute all sql > statements in this file at once. > > Can you tell me what API I should use. > I had the code to execute the statment but I don't know how to call > the file. > Below is my code to execute the single statement. > sqlSt = sqlite3_open( name, &pDb); > strcpy(&stmt[0], "Select * from my table"); > sqlSt = sqlite3_exec(pDb, sqlStmt, NULL, 0, &errMsg) ; > .... > If you can read the whole file into a character array then you can execute it all in a single sqlite3_exec call. That is, sqlite3_exec will process multiple statements in a single string, such as "SELECT * FROM my_table; SELECT * FROM my_other_table;". Or, you could read the file line by line and pass each line to exec, if you know that each line contains a complete SQL statement. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users