IOS -- SQLite数据库判断表是否存在
/** 判断一张表是否已经存在 @param tablename 表名 */ - (BOOL)isExistTable:(NSString *)tablename{ if ([_dataBase open]) { FMResultSet *rs = [_dataBase executeQuery:@"select count(*) as 'count' from sqlite_master where type ='table' and name = ?", tablename]; while ([rs next]){ NSInteger count = [rs intForColumn:@"count"]; if (0 == count){ return NO; } else{ return YES; } } return NO; } return NO; }