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; } }