parent
b0960b98fb
commit
bf57c69042
@ -16,6 +16,7 @@ import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlSchemaType;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
|
||||
import org.jooq.SQLDialect;
|
||||
|
||||
|
||||
/**
|
||||
@ -135,6 +136,9 @@ public class Settings
|
||||
@XmlElement(defaultValue = "LOG_DEBUG")
|
||||
@XmlSchemaType(name = "string")
|
||||
protected ExecuteWithoutWhere executeDeleteWithoutWhere = ExecuteWithoutWhere.LOG_DEBUG;
|
||||
@XmlElement(type = String.class, defaultValue = "DEFAULT")
|
||||
@XmlJavaTypeAdapter(SQLDialectAdapter.class)
|
||||
protected SQLDialect parseDialect;
|
||||
@XmlElement(defaultValue = "IGNORE_ON_FAILURE")
|
||||
@XmlSchemaType(name = "string")
|
||||
protected ParseWithMetaLookups parseWithMetaLookups = ParseWithMetaLookups.IGNORE_ON_FAILURE;
|
||||
@ -1239,6 +1243,30 @@ public class Settings
|
||||
this.executeDeleteWithoutWhere = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* [#7337] The input dialect that should be chosen to disambiguate ambiguous SQL syntax.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public SQLDialect getParseDialect() {
|
||||
return parseDialect;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the parseDialect property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public void setParseDialect(SQLDialect value) {
|
||||
this.parseDialect = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* [#7163] Whether the parser should perform meta lookups in the Configuration's MetaProvider.
|
||||
*
|
||||
@ -1526,6 +1554,11 @@ public class Settings
|
||||
return this;
|
||||
}
|
||||
|
||||
public Settings withParseDialect(SQLDialect value) {
|
||||
setParseDialect(value);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Settings withParseWithMetaLookups(ParseWithMetaLookups value) {
|
||||
setParseWithMetaLookups(value);
|
||||
return this;
|
||||
@ -1759,6 +1792,11 @@ public class Settings
|
||||
sb.append(executeDeleteWithoutWhere);
|
||||
sb.append("</executeDeleteWithoutWhere>");
|
||||
}
|
||||
if (parseDialect!= null) {
|
||||
sb.append("<parseDialect>");
|
||||
sb.append(parseDialect);
|
||||
sb.append("</parseDialect>");
|
||||
}
|
||||
if (parseWithMetaLookups!= null) {
|
||||
sb.append("<parseWithMetaLookups>");
|
||||
sb.append(parseWithMetaLookups);
|
||||
@ -2176,6 +2214,15 @@ public class Settings
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (parseDialect == null) {
|
||||
if (other.parseDialect!= null) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (!parseDialect.equals(other.parseDialect)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (parseWithMetaLookups == null) {
|
||||
if (other.parseWithMetaLookups!= null) {
|
||||
return false;
|
||||
@ -2253,6 +2300,7 @@ public class Settings
|
||||
result = ((prime*result)+((emulateOnDuplicateKeyUpdateOnPrimaryKeyOnly == null)? 0 :emulateOnDuplicateKeyUpdateOnPrimaryKeyOnly.hashCode()));
|
||||
result = ((prime*result)+((executeUpdateWithoutWhere == null)? 0 :executeUpdateWithoutWhere.hashCode()));
|
||||
result = ((prime*result)+((executeDeleteWithoutWhere == null)? 0 :executeDeleteWithoutWhere.hashCode()));
|
||||
result = ((prime*result)+((parseDialect == null)? 0 :parseDialect.hashCode()));
|
||||
result = ((prime*result)+((parseWithMetaLookups == null)? 0 :parseWithMetaLookups.hashCode()));
|
||||
result = ((prime*result)+((parseUnsupportedSyntax == null)? 0 :parseUnsupportedSyntax.hashCode()));
|
||||
result = ((prime*result)+((parseUnknownFunctions == null)? 0 :parseUnknownFunctions.hashCode()));
|
||||
|
||||
@ -39,6 +39,7 @@ package org.jooq.impl;
|
||||
|
||||
import static java.util.Collections.emptyList;
|
||||
import static java.util.Collections.singletonList;
|
||||
// ...
|
||||
import static org.jooq.conf.ParseWithMetaLookups.IGNORE_ON_FAILURE;
|
||||
import static org.jooq.conf.ParseWithMetaLookups.THROW_ON_FAILURE;
|
||||
import static org.jooq.impl.DSL.abs;
|
||||
@ -392,6 +393,7 @@ import org.jooq.Row;
|
||||
import org.jooq.Row2;
|
||||
import org.jooq.RowN;
|
||||
import org.jooq.SQL;
|
||||
import org.jooq.SQLDialect;
|
||||
import org.jooq.Schema;
|
||||
import org.jooq.Select;
|
||||
import org.jooq.SelectFieldOrAsterisk;
|
||||
@ -4150,13 +4152,25 @@ final class ParserImpl implements Parser {
|
||||
result.add(qa);
|
||||
}
|
||||
else {
|
||||
Field<?> field = parseField(ctx);
|
||||
Name alias = null;
|
||||
Field<?> field = null;
|
||||
|
||||
if (parseKeywordIf(ctx, "AS"))
|
||||
alias = parseIdentifier(ctx, true);
|
||||
else if (!peekKeyword(ctx, KEYWORDS_IN_SELECT))
|
||||
alias = parseIdentifierIf(ctx, true);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if (field == null) {
|
||||
field = parseField(ctx);
|
||||
|
||||
if (parseKeywordIf(ctx, "AS"))
|
||||
alias = parseIdentifier(ctx, true);
|
||||
else if (!peekKeyword(ctx, KEYWORDS_IN_SELECT))
|
||||
alias = parseIdentifierIf(ctx, true);
|
||||
}
|
||||
|
||||
result.add(alias == null ? field : field.as(alias));
|
||||
}
|
||||
@ -9109,6 +9123,19 @@ final class ParserContext {
|
||||
this.bindings = bindings;
|
||||
}
|
||||
|
||||
SQLDialect dialect() {
|
||||
SQLDialect result = dsl.configuration().settings().getParseDialect();
|
||||
|
||||
if (result == null)
|
||||
result = SQLDialect.DEFAULT;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
SQLDialect family() {
|
||||
return dialect().family();
|
||||
}
|
||||
|
||||
boolean requireProEdition() {
|
||||
if (!PRO_EDITION)
|
||||
throw exception("Feature only supported in pro edition");
|
||||
|
||||
@ -25,6 +25,11 @@
|
||||
<xjc:javaType name="java.util.Locale" adapter="org.jooq.conf.LocaleAdapter"/>
|
||||
</jaxb:bindings>
|
||||
|
||||
<!-- [#7337] SQLDialects -->
|
||||
<jaxb:bindings schemaLocation="../../xsd/jooq-runtime-3.12.0.xsd" multiple="true" node="//xs:element[@name='parseDialect']">
|
||||
<xjc:javaType name="org.jooq.SQLDialect" adapter="org.jooq.conf.SQLDialectAdapter"/>
|
||||
</jaxb:bindings>
|
||||
|
||||
<!-- Annotate the following classes with @SuppressWarnings -->
|
||||
<jaxb:bindings schemaLocation="../../xsd/jooq-runtime-3.12.0.xsd" multiple="true" node="//xs:complexType">
|
||||
<inheritance:extends>org.jooq.conf.SettingsBase</inheritance:extends>
|
||||
|
||||
@ -246,6 +246,10 @@ jOOQ queries, for which no specific fetchSize value was specified.]]></jxb:javad
|
||||
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[[#6771] Specifies whether DELETE statements are allowed to be executed lacking a WHERE clause. This has no effect on rendering the statements SQL string.]]></jxb:javadoc></jxb:property></appinfo></annotation>
|
||||
</element>
|
||||
|
||||
<element name="parseDialect" type="string" minOccurs="0" maxOccurs="1" default="DEFAULT">
|
||||
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[[#7337] The input dialect that should be chosen to disambiguate ambiguous SQL syntax.]]></jxb:javadoc></jxb:property></appinfo></annotation>
|
||||
</element>
|
||||
|
||||
<element name="parseWithMetaLookups" type="jooq-runtime:ParseWithMetaLookups" minOccurs="0" maxOccurs="1" default="IGNORE_ON_FAILURE">
|
||||
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[[#7163] Whether the parser should perform meta lookups in the Configuration's MetaProvider.]]></jxb:javadoc></jxb:property></appinfo></annotation>
|
||||
</element>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user