Can't you use create table if not exists ...
On 8 April 2011 07:17, RAKESH HEMRAJANI <rakesh_hemraj...@hotmail.com> wrote: > > Hi, > > Need a default table to be created on database initialization. > > i was able to achieve that by executing one create statement query at the end > of the function openDatabase. > > however the problem is that on opening the same DB for the second time, the > query fails with error table already exist. > > findtable function doesnt work since the database is opened but not > initialized (via the function sqliteinit3 and find table fails because of > that). > > Need a place where > findtable should work in both the cases (new as well as existing > database) > if the table already exist, skip else run the create statement > the default table should be created before any user query runs > > the table name will be hardcoded and create statement as well. > > just need the right place to write the below code: > > if (sqlite3FindTable(db, "emp", 0) ==0 ) > { > //Table not found, create the table > rc = sqlite3_exec(db, "create table emp......;",0, 0, 0); > } > > > _______________________________________________ > 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