gpt4 book ai didi

iphone - 保存查询值

转载 作者:行者123 更新时间:2023-11-28 17:35:56 25 4
gpt4 key购买 nike

如何在 NSMutableArray 中保存查询的值。

tempQuery=[@"select * from iapp_tbl_questions where id= " stringByAppendingString:[NSString stringWithFormat:@"%d",rowid1]];


const char *query2=[tempQuery UTF8String];
if (sqlite3_prepare_v2(database,query2,-1,&statement1,NULL)==SQLITE_OK) {
NSLog(@"vt", vt);
vt=[[[Question1 alloc]init]autorelease];
while (sqlite3_step(statement1)==SQLITE_ROW) {

vt.question=[NSString stringWithUTF8String:(char *)sqlite3_column_text(statement1,3)];

}
}
return vt;

谢谢...

最佳答案

const char *query2=[tempQuery UTF8String];
NSMutableArray *results = nil;
if (sqlite3_prepare_v2(database,query2,-1,&statement1,NULL)==SQLITE_OK) {
NSLog(@"vt", vt);
results= [[NSMutableArray alloc]init];
while (sqlite3_step(statement1)==SQLITE_ROW) {
vt=[[[Question1 alloc]init]autorelease];
vt.question=[NSString stringWithUTF8String:(char *)sqlite3_column_text(statement1,3)];
[results addObject:vt];

}
}
return results;

关于iphone - 保存查询值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9820119/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com