當前位置:成語大全網 - 新華字典 - ios靜態庫中怎麽引用fmdb

ios靜態庫中怎麽引用fmdb

般按照代碼即:

NSString* docsdir = [NSSearchPathForDirectoriesInDomains( NSDocumentDirectory, NSUserDomainMask, YES) lastObject];

NSString *dbpath = [docsdir stringByAppendingPathComponent:@"dyobv.sqlite"];

FMDatabase *db = [FMDatabase databaseWithPath:dbpath];

[db open];

FMResultSet *rs = [db executeQuery:@"select * from log_keepers"];

NSMutableArray *array = [NSMutableArray arrayWithCapacity:32];

while([rs next]) {

DYLogKeeper *obj = [[DYLogKeeper alloc] init];

obj.localId = [rs stringForColumn:@"local_id"];

// … 省略賦值操作

[array addObject: obj];

}

[db close];