[#4161] { INSERT | UPDATE | MERGE } .. SET [ Record ] doesn't take changed flags into account
This commit is contained in:
parent
ae9233c758
commit
4c5fe868a2
@ -285,7 +285,9 @@ public interface InsertSetStep<R extends Record> {
|
||||
* Set values in the <code>INSERT</code> statement.
|
||||
* <p>
|
||||
* This is the same as calling {@link #set(Map)} with the argument record
|
||||
* treated as a <code>Map<Field<?>, Object></code>.
|
||||
* treated as a <code>Map<Field<?>, Object></code>, except that the
|
||||
* {@link Record#changed()} flags are taken into consideration in order to
|
||||
* update only changed values.
|
||||
*
|
||||
* @see #set(Map)
|
||||
*/
|
||||
|
||||
@ -107,7 +107,9 @@ public interface MergeMatchedSetStep<R extends Record> {
|
||||
* statement's <code>WHEN MATCHED</code> clause.
|
||||
* <p>
|
||||
* This is the same as calling {@link #set(Map)} with the argument record
|
||||
* treated as a <code>Map<Field<?>, Object></code>.
|
||||
* treated as a <code>Map<Field<?>, Object></code>, except that the
|
||||
* {@link Record#changed()} flags are taken into consideration in order to
|
||||
* update only changed values.
|
||||
*
|
||||
* @see #set(Map)
|
||||
*/
|
||||
|
||||
@ -91,7 +91,9 @@ public interface UpdateSetStep<R extends Record> {
|
||||
* Set a value for a field in the <code>UPDATE</code> statement.
|
||||
* <p>
|
||||
* This is the same as calling {@link #set(Map)} with the argument record
|
||||
* treated as a <code>Map<Field<?>, Object></code>.
|
||||
* treated as a <code>Map<Field<?>, Object></code>, except that the
|
||||
* {@link Record#changed()} flags are taken into consideration in order to
|
||||
* update only changed values.
|
||||
*
|
||||
* @see #set(Map)
|
||||
*/
|
||||
|
||||
@ -483,8 +483,8 @@ abstract class AbstractQuery extends AbstractQueryPart implements Query, Attacha
|
||||
x
|
||||
x
|
||||
|
||||
xx xxxxxxxxxxxxxxxxxxxxxx x xxxxxxxxx x
|
||||
xxxxx xxx xxxxxxxxxxxxxxxxxxxxx xxxx xxxxxxxx x xxxxxx xxxxxxx xxxx xxx xxxx xxxxx xxxxxxxx xxxxxx xxxxxxxx xxxxxxxxx xx x xxxxxxxxxx xxxxxxx xx xxxxxxx xxxxxxxxxxxxxxxxxxxxxx xx xxx xxxx xx xxx xxxx xxxxxxx xxxx xxxx xxxx xxxxxxxxx
|
||||
xx xxxxxxxxxxxxxxxxxxxxxx x xxxxxxxx x
|
||||
xxxxx xxx xxxxxxxxxxxxxxxxxxxxx xxxx xxxxxxxx x xxxxxxx xxxxxxx xxxx xxx xxxx xxxxx xxxxxxxx xxxxxx xxxxxxxx xxxxxxxxx xx x xxxxxxxxxx xxxxxxx xx xxxxxxx xxxxxxxxxxxxxxxxxxxxxx xx xxx xxxx xx xxx xxxx xxxxxxx xxxx xxxx xxxx xxxxxxxxx
|
||||
x
|
||||
|
||||
xx xxxx x xxxxxxxxxxxxxxxxxxxxxxxxxxx x
|
||||
|
||||
@ -630,7 +630,7 @@ class InsertImpl<R extends Record, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
|
||||
|
||||
@Override
|
||||
public final InsertImpl set(Record record) {
|
||||
return set(Utils.map(record));
|
||||
return set(Utils.mapOfChangedValues(record));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -743,7 +743,7 @@ implements
|
||||
|
||||
@Override
|
||||
public final MergeImpl set(Record record) {
|
||||
return set(Utils.map(record));
|
||||
return set(Utils.mapOfChangedValues(record));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -161,7 +161,7 @@ final class UpdateImpl<R extends Record>
|
||||
|
||||
@Override
|
||||
public final UpdateImpl<R> set(Record record) {
|
||||
return set(Utils.map(record));
|
||||
return set(Utils.mapOfChangedValues(record));
|
||||
}
|
||||
|
||||
// [jooq-tools] START [set]
|
||||
|
||||
@ -1103,13 +1103,13 @@ final class Utils {
|
||||
/**
|
||||
* Turn a {@link Record} into a {@link Map}
|
||||
*/
|
||||
static final Map<Field<?>, Object> map(Record record) {
|
||||
static final Map<Field<?>, Object> mapOfChangedValues(Record record) {
|
||||
Map<Field<?>, Object> result = new LinkedHashMap<Field<?>, Object>();
|
||||
int size = record.size();
|
||||
|
||||
for (int i = 0; i < size; i++) {
|
||||
result.put(record.field(i), record.getValue(i));
|
||||
}
|
||||
for (int i = 0; i < size; i++)
|
||||
if (record.changed(i))
|
||||
result.put(record.field(i), record.getValue(i));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user