title: SQLite Out of Memory when preparing insert statement
body: <p>I have a problem with my app it opens this database and selects rows from it ok, </p>
  
  <p>Then when I want to add new rows using the following code and I always get the following problem at the execution of the <code>prepare_V2</code>.</p>
  
  <pre><code>Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Error while creating add statement. 'out of memory''
  </code></pre>
  
  <p>code is .....</p>
  
  <pre><code>static sqlite3 *database = nil;                 
  static sqlite3_stmt *addStmt = nil; 
  
  
  - (BOOL)addUserprofile {
  
      addStmt = nil;  // set to force open for testing
      database = nil; // set to force creation of addstmt for testing
  
      if (database == nil) {  // first time then open database
          NSString *databaseName = @"UserProfile.db";
          // Use editable database paths
          NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory , NSUserDomainMask, YES);
          NSString *documentsDir = [paths objectAtIndex:0];   
          NSString *databasePath = [documentsDir stringByAppendingPathComponent:databaseName];
          NSLog(@"path = %@",databasePath);
  
          NSLog(@"opening Database");
          sqlite3 *database;
          // Open the database from the users filessytem
          if (sqlite3_open([databasePath UTF8String], &amp;database) == SQLITE_OK) {
              NSLog(@"Database Open");
              }
          else {
              NSLog(@"Database did not open");
          }
  
      }
  
      if(addStmt == nil) {
  
  NSLog(@"Creating add stmt");
          const char *sql = "INSERT INTO Profile (ProfileName) VALUES(?)";
  
      if(sqlite3_prepare_v2(database, sql, -1, &amp;addStmt, NULL) != SQLITE_OK) {
              NSAssert1(0, @"** Error while creating add statement. '%s'", sqlite3_errmsg(database));
              success = NO;
              return success;
          }
      }
      sqlite3_bind_text(addStmt, 1, [ProfileName UTF8String], -1, SQLITE_TRANSIENT);
  </code></pre>