title: INSERT OR REPLACE does not update the record in SQLITE
body: <p>I am trying to insert the record in the database and whenever I do so, it inserts the record twice in the database.
  I am using the following query to do my insert:</p>
  
  <pre><code>-(void) insert {
        NSString *sqlQuery = [NSString stringWithFormat:@"INSERT OR REPLACE INTO test(ID,KEY ) VALUES ('%d','%@');", test.id, test.key];
        const char *insert_sql = [sqlQuery UTF8String];
        sqlite3_exec(db, insert_sql, NULL, NULL, NULL);
  }
  </code></pre>
  
  <p>It always enters duplicate records whenever I run this query. Is there a way to check if the data already exists then donot insert just update.</p>