I need to load database: shortSelected - string, array - array of strings, date - date.
I load database from shortSelected(it string that always different) and database has all that values, I pass shortSelected to database, but in 3 string resultSet=nil
. What is wrong?
FMDatabase *database = [FMDatabase sharedInstance];
NSMutableArray *results = [NSMutableArray array];
FMResultSet *resultSet = [database executeQuery:@"SELECT * FROM rss WHERE name = shortSelected"];
NSArray *resultArray = [resultSet objectForColumnName:@"array"];
NSDate *resultDate = [resultSet dateForColumn:@"date"];
[results addObject:resultArray];
[results addObject:resultDate];
self.data = results;
NSLog(@"%@", _data[0][shortSelected]);
You need to call next
method to confirm whether there is data in the set, then to read the data. code should be
while([resultSet next])
{
NSArray *resultArray = [resultSet objectForColumnName:@"array"];
NSDate *resultDate = [resultSet dateForColumn:@"date"];
[results addObject:resultArray];
[results addObject:resultDate];
}