title: sqlite 3 "SQL error 'out of memory' (7)" objc
body: <p>Hi can anyone point out what I'm doing wrong please? The error is this:</p>
  
  <pre><code>SQL error 'out of memory' (7)
  
  
  
    - (NSArray *)RecipeInfo
  {    
      NSMutableArray *retval = [[NSMutableArray alloc] init];
      NSString *query = [NSString stringWithFormat:@"SELECT key, name FROM recipes WHERE type = \'%@\'", self.RecipeType];
  
  NSLog(query);
  
  sqlite3_stmt *statement;
  
  if (sqlite3_prepare_v2(_database, [query UTF8String], -1, &amp;statement, NULL) != SQLITE_OK)
  {
      NSLog(@"[SQLITE] Error when preparing query!");
      NSLog(@"%s SQL error '%s' (%1d)", __FUNCTION__, sqlite3_errmsg(_database), sqlite3_errcode(_database));
  
      }
      else
      {
          while (sqlite3_step(statement) == SQLITE_ROW)
          {
              int uniqueId = sqlite3_column_int(statement, 0);
              char *nameChars = (char *) sqlite3_column_text(statement, 1);
              NSString *name = [[NSString alloc] initWithUTF8String:nameChars];
              RecipeInfo *info = [[RecipeInfo alloc] initWithUniqueId:uniqueId name:name];
              [retval addObject:info];
          }
  
          sqlite3_finalize(statement);
      }
  return retval;
  }
  </code></pre>
  
  <p>The sql executes fine in the database management environment I use, it has to be something to do with the way I'm using the sql api, can anyone spot whats wrong?</p>