sqlite3_prepare_v2问题

时间:2010-07-20 09:28:41

标签: iphone sqlite

我在声明中遇到了一些麻烦:

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

在下面的代码中,此时代码跳出了IF。有人有什么想法吗?

// 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 个答案:

答案 0 :(得分:1)

问题解决了,当我通过Firefox插件SQLite Manager查看数据库时,表名实际上叫做ROUTE。

相关问题