tags:

views:

113

answers:

1

Hello,

I'm having a bit of trouble with statement:

if(sqlite3_prepare_v2(database, sqlStatement, -1, &compiledStatement, NULL) == SQLITE_OK)

in the code below, the code is jumping out of the IF at this point. Anyone any thoughts ?

// Open the database from the users filessytem
 if(sqlite3_open([databasePath UTF8String], &database) == SQLITE_OK) 
 {
  // Setup the SQL Statement and compile it for faster access
  const char *sqlStatement = "select route_name from Route";
  sqlite3_stmt *compiledStatement;
  if(sqlite3_prepare_v2(database, sqlStatement, -1, &compiledStatement, NULL) == SQLITE_OK) 
  {
   // Loop through the results and add them to the feeds array
   while(sqlite3_step(compiledStatement) == SQLITE_ROW) 
   {
    // Read the data from the result row
    NSString *aName = [NSString stringWithUTF8String:(char *)sqlite3_column_text(compiledStatement, 1)];

    // Add the animal object to the animals Array
    //[list addObject:animal];    
    [list addObject:aName];    
    //[animal release];
   }
  }
  // Release the compiled statement from memory
  sqlite3_finalize(compiledStatement);  
 }
 sqlite3_close(database);
+1  A: 

Problem solved, when I view the database through the Firefox plugin SLQite Manage, the table name is actually called ZROUTE.

Stephen
Are you trying to directly access a Core Data SQLite database? If so, it's a pretty bad idea, you can cause all kinds of corruptions doing this.
kubi