diff --git a/jOOQ/src/main/java/org/jooq/conf/Settings.java b/jOOQ/src/main/java/org/jooq/conf/Settings.java
index 4bc6103a24..9979b051ec 100644
--- a/jOOQ/src/main/java/org/jooq/conf/Settings.java
+++ b/jOOQ/src/main/java/org/jooq/conf/Settings.java
@@ -183,6 +183,9 @@ public class Settings
protected ExecuteWithoutWhere executeDeleteWithoutWhere = ExecuteWithoutWhere.LOG_DEBUG;
@XmlElement(type = String.class, defaultValue = "DEFAULT")
@XmlJavaTypeAdapter(SQLDialectAdapter.class)
+ protected SQLDialect interpreterDialect;
+ @XmlElement(type = String.class, defaultValue = "DEFAULT")
+ @XmlJavaTypeAdapter(SQLDialectAdapter.class)
protected SQLDialect parseDialect;
@XmlElement(defaultValue = "OFF")
@XmlSchemaType(name = "string")
@@ -1550,6 +1553,22 @@ public class Settings
this.executeDeleteWithoutWhere = value;
}
+ /**
+ * [#7337] The dialect that should be used to interpret SQL DDL statements. {@link SQLDialect#DEFAULT} means that jOOQ interprets the SQL itself. Any other dialect (if supported) will be interpreted on an actual JDBC connection.
+ *
+ */
+ public SQLDialect getInterpreterDialect() {
+ return interpreterDialect;
+ }
+
+ /**
+ * [#7337] The dialect that should be used to interpret SQL DDL statements. {@link SQLDialect#DEFAULT} means that jOOQ interprets the SQL itself. Any other dialect (if supported) will be interpreted on an actual JDBC connection.
+ *
+ */
+ public void setInterpreterDialect(SQLDialect value) {
+ this.interpreterDialect = value;
+ }
+
/**
* [#7337] The input dialect that should be chosen to disambiguate ambiguous SQL syntax.
*
@@ -2170,6 +2189,15 @@ public class Settings
return this;
}
+ /**
+ * [#7337] The dialect that should be used to interpret SQL DDL statements. {@link SQLDialect#DEFAULT} means that jOOQ interprets the SQL itself. Any other dialect (if supported) will be interpreted on an actual JDBC connection.
+ *
+ */
+ public Settings withInterpreterDialect(SQLDialect value) {
+ setInterpreterDialect(value);
+ return this;
+ }
+
/**
* [#7337] The input dialect that should be chosen to disambiguate ambiguous SQL syntax.
*
@@ -2313,6 +2341,7 @@ public class Settings
builder.append("emulateOnDuplicateKeyUpdateOnPrimaryKeyOnly", emulateOnDuplicateKeyUpdateOnPrimaryKeyOnly);
builder.append("executeUpdateWithoutWhere", executeUpdateWithoutWhere);
builder.append("executeDeleteWithoutWhere", executeDeleteWithoutWhere);
+ builder.append("interpreterDialect", interpreterDialect);
builder.append("parseDialect", parseDialect);
builder.append("parseWithMetaLookups", parseWithMetaLookups);
builder.append("parseUnsupportedSyntax", parseUnsupportedSyntax);
@@ -2891,6 +2920,15 @@ public class Settings
return false;
}
}
+ if (interpreterDialect == null) {
+ if (other.interpreterDialect!= null) {
+ return false;
+ }
+ } else {
+ if (!interpreterDialect.equals(other.interpreterDialect)) {
+ return false;
+ }
+ }
if (parseDialect == null) {
if (other.parseDialect!= null) {
return false;
@@ -3031,6 +3069,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)+((interpreterDialect == null)? 0 :interpreterDialect.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()));
diff --git a/jOOQ/src/main/java/org/jooq/impl/DDLInterpreterMetaProvider.java b/jOOQ/src/main/java/org/jooq/impl/DDLInterpreterMetaProvider.java
index 2256654cc2..84e92fa510 100644
--- a/jOOQ/src/main/java/org/jooq/impl/DDLInterpreterMetaProvider.java
+++ b/jOOQ/src/main/java/org/jooq/impl/DDLInterpreterMetaProvider.java
@@ -63,18 +63,18 @@ final class DDLInterpreterMetaProvider implements MetaProvider {
private static final JooqLogger log = JooqLogger.getLogger(DDLInterpreterMetaProvider.class);
private final Configuration configuration;
- private final Source[] scripts;
+ private final Source[] sources;
private final Query[] queries;
- public DDLInterpreterMetaProvider(Configuration configuration, Source... scripts) {
+ public DDLInterpreterMetaProvider(Configuration configuration, Source... sources) {
this.configuration = configuration == null ? new DefaultConfiguration() : configuration;
- this.scripts = scripts;
+ this.sources = sources;
this.queries = null;
}
public DDLInterpreterMetaProvider(Configuration configuration, Query... queries) {
this.configuration = configuration == null ? new DefaultConfiguration() : configuration;
- this.scripts = null;
+ this.sources = null;
this.queries = queries;
}
@@ -84,9 +84,9 @@ final class DDLInterpreterMetaProvider implements MetaProvider {
Configuration localConfiguration = configuration.derive();
DSLContext ctx = DSL.using(localConfiguration);
- if (scripts != null)
- for (Source script : scripts)
- loadScript(ctx, script, interpreter);
+ if (sources != null)
+ for (Source source : sources)
+ loadSource(ctx, source, interpreter);
else
for (Query query : queries)
interpreter.accept(query);
@@ -94,7 +94,7 @@ final class DDLInterpreterMetaProvider implements MetaProvider {
return interpreter.meta();
}
- private final void loadScript(DSLContext ctx, Source source, DDLInterpreter interpreter) {
+ private final void loadSource(DSLContext ctx, Source source, DDLInterpreter interpreter) {
Reader reader = source.reader();
try {
Scanner s = new Scanner(reader).useDelimiter("\\A");
diff --git a/jOOQ/src/main/java/org/jooq/impl/SourceMetaProvider.java b/jOOQ/src/main/java/org/jooq/impl/SourceMetaProvider.java
index cdc28b975b..b8507a649e 100644
--- a/jOOQ/src/main/java/org/jooq/impl/SourceMetaProvider.java
+++ b/jOOQ/src/main/java/org/jooq/impl/SourceMetaProvider.java
@@ -37,6 +37,8 @@
*/
package org.jooq.impl;
+import static org.jooq.SQLDialect.DEFAULT;
+import static org.jooq.tools.StringUtils.defaultIfNull;
import static org.jooq.tools.jdbc.JDBCUtils.safeClose;
import java.io.IOException;
@@ -46,6 +48,7 @@ import java.io.StringWriter;
import org.jooq.Configuration;
import org.jooq.Meta;
import org.jooq.MetaProvider;
+import org.jooq.SQLDialect;
import org.jooq.Source;
@@ -94,6 +97,16 @@ final class SourceMetaProvider implements MetaProvider {
return new InformationSchemaMetaProvider(configuration, sources).provide();
}
- return new DDLMetaProvider(configuration, sources).provide();
+ SQLDialect dialect = configuration.settings().getInterpreterDialect();
+ switch (defaultIfNull(dialect, DEFAULT)) {
+ case DEFAULT:
+ return new DDLInterpreterMetaProvider(configuration, sources).provide();
+
+ case H2:
+ return new DDLMetaProvider(configuration, sources).provide();
+
+ default:
+ throw new UnsupportedOperationException("Interpreter dialect not yet supported: " + dialect);
+ }
}
}
diff --git a/jOOQ/src/main/resources/xjb/runtime/binding.xjb b/jOOQ/src/main/resources/xjb/runtime/binding.xjb
index 825e8d568e..55972b9962 100644
--- a/jOOQ/src/main/resources/xjb/runtime/binding.xjb
+++ b/jOOQ/src/main/resources/xjb/runtime/binding.xjb
@@ -25,8 +25,8 @@
-
-
+
+
diff --git a/jOOQ/src/main/resources/xsd/jooq-runtime-3.13.0.xsd b/jOOQ/src/main/resources/xsd/jooq-runtime-3.13.0.xsd
index 482af7b32d..d5fffc5489 100644
--- a/jOOQ/src/main/resources/xsd/jooq-runtime-3.13.0.xsd
+++ b/jOOQ/src/main/resources/xsd/jooq-runtime-3.13.0.xsd
@@ -379,6 +379,10 @@ jOOQ queries, for which no specific fetchSize value was specified.]]>
+
+
+
+