title: SQLite database UPDATE or INSERT not work
body: <p>I want to <code>update</code> my <code>database</code> like this: if row exists <code>update</code> it and if row doesn't exist add a new one. In TABLE_MAP_MARKER <code>insert</code> is working but <code>update</code> is not working and in TABLE_MAP_MARKER_INFO in general both, update and insert, don't work. Where is my mistake? Please help me!</p>
  
  <p>Below is my code :</p>
  
  <pre><code> SQLiteDatabase db = this.getWritableDatabase();
      ContentValues marker_position_values= new ContentValues();
      marker_position_values.put(KEY_MARKER_LAT, map_marker_lat_value);
      marker_position_values.put(KEY_MARKER_LNG, map_marker_long_value);
  
      long marker_id_table = db.update(TABLE_MAP_MARKER, marker_position_values, HOME_ID + " = ?", new String[]String.valueOf(home_id)});
      if (marker_id_table == 0) {
          db.insertWithOnConflict(TABLE_MAP_MARKER, null, marker_position_values, SQLiteDatabase.CONFLICT_REPLACE);
      }
      ContentValues unit_values= new ContentValues();
      unit_values.put(HOME_ID, marker_id_table);
      unit_values.put(HOME_TYPE, home_type);      
      unit_values.put(AMOUNT_RENT, amount_rent);
  
      long unit_id_table = db.update(TABLE_MAP_MARKER_INFO, unit_values, HOME_ID + " = ?", new String[]{String.valueOf(home_id)});
      if (unit_id_table == 0) {
          db.insert WithOnConflict(TABLE_MAP_MARKER_INFO, null, unit_values, SQLiteDatabase.CONFLICT_REPLACE);
      }
  </code></pre>