您好,欢迎来到二三娱乐。
搜索
您的当前位置:首页【FMDB使用】需求:从数据库中 ,查询未读消息的个数

【FMDB使用】需求:从数据库中 ,查询未读消息的个数

来源:二三娱乐

SQL语句:select * from notification where isNew = '1'

- (NSInteger)getNotificationNoReadNumber{
NSString *path = [NSHomeDirectory() stringByAppendingString:@"/Library/Caches/Container.db"];
FMDatabase *database = [FMDatabase databaseWithPath:path]; if ([database open]) { NSString *sql = [NSString stringWithFormat:@"select * from notification where isNew = '1'"]; FMResultSet *set = [database executeQuery:sql]; int num = 0; while ([set next]) { num ++; } [database close]; return num; } else{ NSLog(@"could not open dababase!"); return 0; } }

Copyright © 2019- yule263.com 版权所有 湘ICP备2023023988号-1

违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务