Skip to content

Commit

Permalink
[#1677] [#2769] [#6485] Support RETURNING * and RETURNING t.*
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaseder committed Feb 1, 2018
1 parent 7124fe0 commit 6fcd413
Showing 1 changed file with 5 additions and 14 deletions.
19 changes: 5 additions & 14 deletions jOOQ/src/main/java/org/jooq/impl/ParserImpl.java
Expand Up @@ -1064,10 +1064,7 @@ private static final Delete<?> parseDelete(ParserContext ctx, WithImpl with) {
: s1; : s1;


if (parseKeywordIf(ctx, "RETURNING")) if (parseKeywordIf(ctx, "RETURNING"))
if (parseIf(ctx, '*')) return s2.returning(parseSelectList(ctx));
return s2.returning();
else
return s2.returning(parseFields(ctx));
else else
return s2; return s2;
} }
Expand Down Expand Up @@ -1181,10 +1178,7 @@ else if (parseKeywordIf(ctx, "UPDATE SET")) {
} }


if (parseKeywordIf(ctx, "RETURNING")) if (parseKeywordIf(ctx, "RETURNING"))
if (parseIf(ctx, '*')) return returning.returning(parseSelectList(ctx));
return returning.returning();
else
return returning.returning(parseFields(ctx));
else else
return returning; return returning;
} }
Expand All @@ -1201,17 +1195,14 @@ private static final Update<?> parseUpdate(ParserContext ctx, WithImpl with) {
// TODO support FROM // TODO support FROM
Condition condition = parseKeywordIf(ctx, "WHERE") ? parseCondition(ctx) : null; Condition condition = parseKeywordIf(ctx, "WHERE") ? parseCondition(ctx) : null;


UpdateReturningStep<?> returning = condition == null UpdateReturningStep<?> s2 = condition == null
? s1.set(map) ? s1.set(map)
: s1.set(map).where(condition); : s1.set(map).where(condition);


if (parseKeywordIf(ctx, "RETURNING")) if (parseKeywordIf(ctx, "RETURNING"))
if (parseIf(ctx, '*')) return s2.returning(parseSelectList(ctx));
return returning.returning();
else
return returning.returning(parseFields(ctx));
else else
return returning; return s2;
} }


private static final Map<Field<?>, Object> parseSetClauseList(ParserContext ctx) { private static final Map<Field<?>, Object> parseSetClauseList(ParserContext ctx) {
Expand Down

0 comments on commit 6fcd413

Please sign in to comment.