sqlite创建表的有关问题
sqlite创建表的问题。
string strSQL= "create table test_tab (f1 int, f2 long);";
int res= sqlite3_exec(pDB , dropTab.c_str() , 0 , 0 , &errMsg);
我用上面的方式创建了数据表,如何改成,如果表存在就用原来创建的表,如果不存在才创建啊?
------解决方案--------------------
添加子句:IF NOT EXISTS
http://www.sqlite.org/lang_createtable.html
string strSQL= "create table test_tab (f1 int, f2 long);";
int res= sqlite3_exec(pDB , dropTab.c_str() , 0 , 0 , &errMsg);
我用上面的方式创建了数据表,如何改成,如果表存在就用原来创建的表,如果不存在才创建啊?
sqlite
------解决方案--------------------
添加子句:IF NOT EXISTS
CREATE TABLE IF NOT EXISTS foo (...)
http://www.sqlite.org/lang_createtable.html