[jOOQ/jOOQ#11436] Support parsing UPDATE .. SET (row) = (subquery)
This commit is contained in:
parent
3f706e1951
commit
ac3bf49009
@ -2207,10 +2207,25 @@ final class ParserContext {
|
||||
List<Table<?>> from = parseKeywordIf("FROM") ? parseTables() : null;
|
||||
|
||||
parseKeyword("SET");
|
||||
UpdateFromStep<?> s2;
|
||||
|
||||
if (peek('(')) {
|
||||
Row row = parseRow();
|
||||
parse('=');
|
||||
|
||||
// TODO Can we extract a public API for this?
|
||||
if (peekSelectOrWith(true))
|
||||
((UpdateImpl<?>) s1).getDelegate().addValues0(row, parseWithOrSelect(row.size()));
|
||||
else
|
||||
((UpdateImpl<?>) s1).getDelegate().addValues0(row, parseRow(row.size()));
|
||||
|
||||
s2 = (UpdateFromStep<?>) s1;
|
||||
}
|
||||
else {
|
||||
Map<Field<?>, Object> map = parseSetClauseList();
|
||||
s2 = s1.set(map);
|
||||
}
|
||||
|
||||
// TODO Row value expression updates
|
||||
Map<Field<?>, Object> map = parseSetClauseList();
|
||||
UpdateFromStep<?> s2 = s1.set(map);
|
||||
UpdateWhereStep<?> s3 = from != null
|
||||
? s2.from(from)
|
||||
: parseKeywordIf("FROM")
|
||||
|
||||
@ -123,7 +123,7 @@ import org.jooq.UpdateWhereStep;
|
||||
*/
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
final class UpdateImpl<R extends Record>
|
||||
extends AbstractDelegatingRowCountQuery<R, UpdateQuery<R>>
|
||||
extends AbstractDelegatingRowCountQuery<R, UpdateQueryImpl<R>>
|
||||
implements
|
||||
|
||||
// Cascading interface implementations for Update behaviour
|
||||
|
||||
@ -427,12 +427,12 @@ final class UpdateQueryImpl<R extends Record> extends AbstractStoreQuery<R> impl
|
||||
|
||||
|
||||
|
||||
private final void addValues0(Row row, Row value) {
|
||||
final void addValues0(Row row, Row value) {
|
||||
multiRow = row;
|
||||
multiValue = value;
|
||||
}
|
||||
|
||||
private final void addValues0(Row row, Select<?> select) {
|
||||
final void addValues0(Row row, Select<?> select) {
|
||||
multiRow = row;
|
||||
multiSelect = select;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user