cpjolicoeur/mojo-database — Issue #2: Now rows gets selected
Author: renepardon
Created: 2011-12-13 07:40:13+00:00
State: open

Hi,

i followed your instructions but now rows will be returned.

The following line results in SQLITE_DONE and now rows are fetched.
while (sqlite3_step(statement) == SQLITE_ROW) {

My setup looks like:

// Model:
@interface Genre : MojoModel
@property (nonatomic, retain) NSString* name;
@end
@implementation Genre
@synthesize name=_name;
@end

// App delegate:
self.myDatabase = [[AppDatabase alloc] initWithMigrations];
#ifdef TARGET_IPHONE_SIMULATOR
[self.myDatabase setLogging:YES];
#endif

// App database:
[self createGenreTable];
-(void)createGenreTable
{
[self executeSql:@"CREATE TABLE `main`.`Genre` (`primaryKey` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL UNIQUE , `name` VARCHAR);"];
}

There are already two rows within this table.
I tried fetching them with custom sql and with [Genre findAll];

best regards
René