sqlite3-判断数据库和表的状态
目录
sqlite3 判断数据库和表的状态
`1、判断数据库是否存在,如果存在rc!=0 否则==0 ,同时数据库不存在的话也不会创建caen.db3, 此处与sqlite3_open不用! =》rc = sqlite3_open_v2(“caen.db3”, &db, SQLITE_OPEN_READWRITE, NULL);
2、判断数据库中某个表的存在,如果sql执行成功zErrMsg=NULL,否则给出错误信息:no sucn table:表名`
char *zErrMsg ;
char *sqls="SELECT * FROM BaseInfo";
char *datatable;
int nRow;
int nColumn;
/**判断有没有这张表**/
if (sqlite3_get_table(db,sqls,&datatable,&nRow,&nColumn,&zErrMsg)!=NULL) {
}