Since none of the statements is a SELECT, as far as I know the callback would never be called. You can pass a zero as the callback address.
get_table will also handle all the statements in one pass, but will return an empty able, so you might as well use exec. David On 06/21/2011 07:59 AM, e-mail mgbg25171 wrote: > Thank you for the clarification re... > sqlite3_prepareXXX() only processing 1 statement at a time as opposed to > sqlite3_exec() which... > can handle "combined multi statements" in one shot. > I was looking at prepare/step/finalise as a means of avoiding the callback > inherent in sqlite3_exec(). > In the example I saw...the "combined multi statements" string was processed > by SQLite3_Get_Table which... > I assume can also handle "combined multi statements" > Thank you both for your assistance. > As you can probably gather...this is very new to me. > > On 21 June 2011 12:48, David Bicking<dbic...@yahoo.com> wrote: > >> On 06/21/2011 07:22 AM, e-mail mgbg25171 wrote: >>> The commented out lines work. >>> I'm wondering... >>> a) is it possible to do what's not commented out >>> b) what's the syntax re the "sql =..." and "sql +=..." lines >>> Any help much appreciated! >>> <snip> > >>> sql = "BEGIN"; //you need to add newline here >>> sql += "create table episodes (id integer primary key, season int, name >>> text)"; >>> sql += "insert into episodes(id, season, name) Values(1,2,'bill')"; >>> sql += "insert into episodes(id, season, name) Values(2,3,'bob')"; >>> sql += "COMMIT"; >>> rc = sqlite3_prepare(db, sql.c_str(), strlen( sql.c_str() ),&stmt,&tail); >>> rc = sqlite3_step(stmt); >> >> You will need to add semicolons within the quotes between each statement >> as someone has already pointed out. >> >> Secondly, prepare only prepares one statement, so you would have to loop >> through the statements. My C is rusty, but I think it is something like: >> >> tail = sql.c_str(); >> while (tail) >> { >> rc = sqlite3_prepare(db, tail, strlen(tail),&stmt,&tail); >> rc = sqlite3_step(stmt); >> rc = sqlite3_finalize(stmt); >> } >> >> >> Alternatively, you can run the combined multi statements through >> sqlite3_exec() in one shot. >> >> David _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users