[jOOQ/jOOQ#11831] Support parsing array(select)
This commit is contained in:
parent
f8cd4a9791
commit
8c0f7eb076
@ -8476,19 +8476,28 @@ final class DefaultParseContext extends AbstractScope implements ParseContext {
|
||||
|
||||
private final Field<?> parseArrayValueConstructorIf() {
|
||||
if (parseKeywordIf("ARRAY")) {
|
||||
parse('[');
|
||||
if (parseIf('[')) {
|
||||
List<Field<?>> fields;
|
||||
|
||||
List<Field<?>> fields;
|
||||
if (parseIf(']')) {
|
||||
fields = emptyList();
|
||||
}
|
||||
else {
|
||||
fields = parseList(',', ParseContext::parseField);
|
||||
parse(']');
|
||||
}
|
||||
if (parseIf(']')) {
|
||||
fields = emptyList();
|
||||
}
|
||||
else {
|
||||
fields = parseList(',', ParseContext::parseField);
|
||||
parse(']');
|
||||
}
|
||||
|
||||
// Prevent "wrong" javac method bind
|
||||
return DSL.array((Collection) fields);
|
||||
// Prevent "wrong" javac method bind
|
||||
return DSL.array((Collection) fields);
|
||||
}
|
||||
else if (parseIf('(')) {
|
||||
SelectQueryImpl select = parseWithOrSelect(1);
|
||||
parse(')');
|
||||
|
||||
return DSL.array(select);
|
||||
}
|
||||
else
|
||||
throw expected("[", "(");
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
@ -283,6 +283,8 @@ import org.jooq.tools.Convert;
|
||||
import org.jooq.tools.JooqLogger;
|
||||
import org.jooq.tools.StringUtils;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* A sub-select is a <code>SELECT</code> statement that can be combined with
|
||||
* other <code>SELECT</code> statement in <code>UNION</code>s and similar
|
||||
|
||||
Loading…
Reference in New Issue
Block a user