public int updateWithOnConflict(String table,ContentValues values,String whereClause,String[] whereArgs,@ConflictAlgorithm int conflictAlgorithm){
  if (values == null || values.size() == 0) {
    throw new IllegalArgumentException("Empty values");
  }
  acquireReference();
  try {
    StringBuilder sql=new StringBuilder(120);
    sql.append("UPDATE ");
    sql.append(CONFLICT_VALUES[conflictAlgorithm]);
    sql.append(table);
    sql.append(" SET ");
    int setValuesSize=values.size();
    int bindArgsSize=(whereArgs == null) ? setValuesSize : (setValuesSize + whereArgs.length);
    Object[] bindArgs=new Object[bindArgsSize];
    int i=0;
    for (    Map.Entry<String,Object> entry : values.valueSet()) {
      sql.append((i > 0) ? "," : "");
      sql.append(entry.getKey());
      bindArgs[i++]=entry.getValue();
      sql.append("=?");
    }
    if (whereArgs != null) {
      for (i=setValuesSize; i < bindArgsSize; i++) {
        bindArgs[i]=whereArgs[i - setValuesSize];
      }
    }
    if (!TextUtils.isEmpty(whereClause)) {
      sql.append(" WHERE ");
      sql.append(whereClause);
    }
    SQLiteStatement statement=new SQLiteStatement(this,sql.toString(),bindArgs);
    try {
      return statement.executeUpdateDelete();
    }
  finally {
      statement.close();
    }
  }
  finally {
    releaseReference();
  }
}

public int updateWithOnConflict ( String table , ContentValues values , String whereClause , String [ ] whereArgs , @ ConflictAlgorithm int conflictAlgorithm ) { if ( values == null || values . size ( ) == 0 ) { throw new IllegalArgumentException ( "Empty values" ) ; } acquireReference ( ) ; try { StringBuilder sql = new StringBuilder ( 120 ) ; sql . append ( "UPDATE " ) ; sql . append ( CONFLICT_VALUES [ conflictAlgorithm ] ) ; sql . append ( table ) ; sql . append ( " SET " ) ; int setValuesSize = values . size ( ) ; int bindArgsSize = ( whereArgs == null ) ? setValuesSize : ( setValuesSize + whereArgs . length ) ; Object [ ] bindArgs = new Object [ bindArgsSize ] ; int i = 0 ; for ( Map . Entry < String , Object > entry : values . valueSet ( ) ) { sql . append ( ( i > 0 ) ? "," : "" ) ; sql . append ( entry . getKey ( ) ) ; bindArgs [ i ++ ] = entry . getValue ( ) ; sql . append ( "=?" ) ; } if ( whereArgs != null ) { for ( i = setValuesSize ; i < bindArgsSize ; i ++ ) { bindArgs [ i ] = whereArgs [ i - setValuesSize ] ; } } if ( ! TextUtils . isEmpty ( whereClause ) ) { sql . append ( " WHERE " ) ; sql . append ( whereClause ) ; } SQLiteStatement statement = new SQLiteStatement ( this , sql . toString ( ) , bindArgs ) ; try { return statement . executeUpdateDelete ( ) ; } finally { statement . close ( ) ; } } finally { releaseReference ( ) ; } }
convenience method for updating rows in the database .
