首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

sqlite创建表的有关问题

2013-11-15 
sqlite创建表的问题。string strSQL create table test_tab (f1 int, f2 long)int res sqlite3_exec(

sqlite创建表的问题。
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

热点排行