Thanks for the info. So I don't want to read the file into array and executes it. I have the define the array of characters as below: .output outputFile.mode csv select startTime, appName, appType, isAppDeleted, remoteWXId; but it didn't work. Can you please help. Thanks, JP
----- Original Message ---- From: Fin Springs <[EMAIL PROTECTED]> To: sqlite-users@sqlite.org Sent: Wednesday, April 23, 2008 6:25:12 AM Subject: Re: [sqlite] How to execute the statment file using sqlite API 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 ____________________________________________________________________________________ Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users