FMDB中判断Sqlite的表是否存在

前端之家收集整理的这篇文章主要介绍了FMDB中判断Sqlite的表是否存在前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
- (BOOL) isTableOK:(NSString *)tableName
{
    FMResultSet *rs = [self.DB executeQuery:@"select count(*) as 'count' from sqlite_master where type ='table' and name = ?",tableName];
    while ([rs next])
    {
        // just print out what we've got in a number of formats.
        NSInteger count = [rs intForColumn:@"count"];
        NSLog(@"isTableOK %d",count);

        if (0 == count)
        {
            return NO;
        }
        else
        {
            return YES;
        }
    }

    return NO;
}
原文链接:https://www.f2er.com/sqlite/199352.html

猜你在找的Sqlite相关文章