[jOOQ/jOOQ#6587] Add InsertQuery.setRecordForUpdate(Record)
This commit is contained in:
parent
2fd7beeafa
commit
b5fb969a55
@ -105,10 +105,7 @@ public interface InsertQuery<R extends Record> extends StoreQuery<R>, Insert<R>,
|
||||
void newRecord();
|
||||
|
||||
/**
|
||||
* Short for calling <code>
|
||||
* newRecord();
|
||||
* setRecord(record);
|
||||
* </code>
|
||||
* Short for calling {@link #newRecord()} and {@link #setRecord(Record)}.
|
||||
*
|
||||
* @param record The record to add to this insert statement.
|
||||
*/
|
||||
@ -259,6 +256,17 @@ public interface InsertQuery<R extends Record> extends StoreQuery<R>, Insert<R>,
|
||||
@Support({ CUBRID, DERBY, DUCKDB, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTEDB })
|
||||
void addValuesForUpdate(Map<?, ?> map);
|
||||
|
||||
/**
|
||||
* Add multiple values to the <code>ON DUPLICATE KEY UPDATE</code> clause of
|
||||
* this <code>INSERT</code> statement, where this is supported.
|
||||
* <p>
|
||||
* This works like {@link #setRecord(Record)}.
|
||||
*
|
||||
* @param record The record to add to this insert statement.
|
||||
*/
|
||||
@Support({ CUBRID, DERBY, DUCKDB, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTEDB })
|
||||
void setRecordForUpdate(R record);
|
||||
|
||||
/**
|
||||
* Adds a new condition the {@link #onConflict(Field...)} clause.
|
||||
* <p>
|
||||
|
||||
@ -300,6 +300,14 @@ implements
|
||||
updateMap.set(map);
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
@Override
|
||||
public final void setRecordForUpdate(R record) {
|
||||
for (int i = 0; i < record.size(); i++)
|
||||
if (record.changed(i))
|
||||
addValueForUpdate((Field) record.field(i), record.get(i));
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void addConditions(Condition conditions) {
|
||||
updateWhere.addConditions(conditions);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user