【发布时间】:2012-01-02 16:40:18
【问题描述】:
我使用 2 个 sqlite db 文件。
1) 从一个 sqlite db 中填充项目。
@property (nonatomic, strong) NSMutableArray *items;
.......
FMResultSet *results = [db1 executeQuery:query];
while ([results next]) {
Book *book = [[Book alloc] init];
book.content = [results stringForColumn:@"Zcontent"];
book.title = [results stringForColumn:@"Ztitle"];
book.idx = [results intForColumn:@"Zidx"];
book.highlight_YN = NO;
[items addObject:book];
[book release];
}
2)然后,从其他-B- sqlite db中选择项目。
FMDatabase *userDB = [FMDatabase databaseWithPath:userfmdbPath];
NSString *query2 = [NSString stringWithFormat:@"SELECT zidx, highlight_YN FROM zHighlight where zbook = %d and zchapter = %d order by zidx ", pBook,pChapter];
FMResultSet *userresults = [userDB executeQuery:query2];
3) 问题:与results - zidx 相比,我想修改结果为userresults 的项目的属性(highlight_YN)。
如何修改NSMutableArray 属性?
【问题讨论】:
-
我在上面的代码中没有看到 NSMutableArray。事实上,我看到了各种各样的问题(比如
[items addObject:bible]中的bible来自哪里?)。请修改您的问题以清理您的代码并引入 NSMutableArray。 -
@Michael Dautermann 对不起!我遗漏了一些代码。谢谢!!我的问题已编辑。 ^^*
标签: iphone objective-c ios sqlite nsmutablearray