title: Android: SQLite - insertWithOnConflict
body: <p>I am calling insertWithOnConflict, using SQLiteDatabase.CONFLICT_IGNORE. However, when a conflict occurs "-1" is returned instead of the id of the existing row. How do I correct this?</p>
  
  <p>Table creation:</p>
  
  <p><strong>EDIT :</strong></p>
  
  <pre><code>String CREATE_CATEGORY_TABLE = "CREATE TABLE "+TABLE_CATEGORY+"(" +
      BaseColumns._ID+" INTEGER PRIMARY KEY AUTOINCREMENT, "+
      KEY_CATEGORY_NAME+" TEXT UNIQUE" +
      ")";
  db.execSQL(CREATE_CATEGORY_TABLE);
  </code></pre>
  
  <p>Insert statement:</p>
  
  <pre><code>ContentValues values = new ContentValues();
  values.put(KEY_CATEGORY_NAME, name);
  int catID = (int) db.insertWithOnConflict(TABLE_CATEGORY, null, values, SQLiteDatabase.CONFLICT_IGNORE);
  </code></pre>