Hello -

I am trying to get my simulator to work with sqlite and was wondering if I was missing some step?

Here is a snippet of code:

- (void)initializeDatabase {
        NSMutableArray *items = [[NSMutableArray alloc] init];
        self.produceItems = items;
        [items release];

        // The database is stored in the application bundle.
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *path = [documentsDirectory stringByAppendingPathComponent:@"whatsfresh.sqlite"];
        
        
// Open the database. The database was prepared outside the application.
    if (sqlite3_open([path UTF8String], &database) == SQLITE_OK) {
NSLog(@"Open Database");
                // Get the primary key for all produce.
                const char *sql = "SELECT id FROM Item";
        sqlite3_stmt *statement;
// Preparing a statement compiles the SQL query into a byte- code program in the SQLite library. // The third parameter is either the length of the SQL string or -1 to read up to the first null terminator. if (sqlite3_prepare_v2(database, sql, -1, &statement, NULL) == SQLITE_OK) {

NEVER GETS PAST THIS IF. I have queried the database and the data is in there?!

Thanks
James Cicenia
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to