FMDB 查询是否存在某个表,或某个数据
2024-10-16 01:17:14
//监测数据库中我要需要的表是否已经存在
NSString *existsSql = [NSString stringWithFormat:@"select count(name) as countNum from sqlite_master where type = 'table' and name = '%@'", @"Member" ];
FMResultSet *rs = [membersDB executeQuery:existsSql]; if ([rs next]) {
NSInteger count = [rs intForColumn:@"countNum"];
NSLog(@"The table count: %li", count);
if (count == 1) {
NSLog(@"存在");
return;
}
}
//检测某个数据是否存在
FMResultSet *rs =[membersDB executeQuery:@"SELECT COUNT(Name) AS countNum FROM Member WHERE Name = ?",self.nameTextField.text];
while ([rs next]) {
NSInteger count = [rs intForColumn:@"countNum"];
if (count > 0) {
//存在
}
else
{
//不存在
}
}
最新文章
- 客户关系管理系统-CRM源码
- linux 中文件权限和磁盘管理、linux服务器项目如何部署
- React Native 组件样式测试
- spring+ibatis整合
- Vue数据绑定隐藏的神坑....
- libgdx 常见问题
- MSSQL大数据量增加字段耗时对比
- Kafka集群模式部署
- 鸟哥的linux私房菜学习记录之正则表达式
- jsoup的基本写法
- 拥抱高效、拥抱 Bugtags 之来自用户的声音(四)
- [POJ] 3264 Balanced Lineup [线段树]
- 关于C++的子类指针指向父类
- STM32F4xx时钟理解
- 在现有代码中通过async/await实现并行
- Beta第二天
- webpack 样式表抽离成专门的单独文件并且设置版本号
- ELK之filebeat、logstash多个topic配置
- CentOS7.0小随笔——指令基本操作(Part.B)
- python性能分析之cProfile模块
热门文章
- .Cannot create an NSPersistentStoreCoordinator with a nil model
- 获取输入设备的vid和pid
- Eclipse如何自定义format代码
- UIView的基本属性及ANimation
- runtime——消息机制
- Json与Gson讲解
- 关于tag,viewWithTag
- dirname(_file_) DIRECTORY_SEPARATOR
- HUD 1541/BIT(数状数组)
- 4位开锁<;dfs>;