我想从数组(imagearray)中的数据库中选择数据游标正在通过字典,但数据不存储在数组中......
-(void)getdataFromDatabase
{
NSString *sqlQueryString =[NSString stringWithFormat:@"SELECT imageName,imageDetail,Date_Time FROM Image_Table"];
const char *sql=[sqlQueryString UTF8String];
sqlite3_stmt *statement;
if (sqlite3_prepare_v2(delegate.DVCRS, sql, -1, &statement, NULL) == SQLITE_OK)
{
while (sqlite3_step(statement) == SQLITE_ROW)
{
NSMutableDictionary *dicRD = [[NSMutableDictionary alloc]init];
[dicRD setValue:[NSString stringWithUTF8String:(char *)sqlite3_column_text(statement, 0)] forKey:@"imageName"];
[dicRD setValue:[NSString stringWithUTF8String:(char *)sqlite3_column_text(statement, 1)] forKey:@"imageDetail"];
[dicRD setValue:[NSString stringWithUTF8String:(char *)sqlite3_column_text(statement, 2)] forKey:@"Date_Time"];
[imagearray addObject:dicRD];
[imagenamearray addObject:dicRD];
}
NSLog(@"Main Object data is %d",[imagearray count]);
}
else
{
NSLog(@"ERROR getdata %s",(char *)sqlite3_errmsg(delegate.DVCRS));
}
sqlite3_reset(statement);
sqlite3_finalize(statement);
}