diff --git a/jOOQ/src/main/java/org/jooq/conf/Settings.java b/jOOQ/src/main/java/org/jooq/conf/Settings.java
index e97d08cb10..9aea87683d 100644
--- a/jOOQ/src/main/java/org/jooq/conf/Settings.java
+++ b/jOOQ/src/main/java/org/jooq/conf/Settings.java
@@ -314,6 +314,9 @@ public class Settings
protected Boolean executeLogging = true;
@XmlElement(defaultValue = "true")
protected Boolean diagnosticsLogging = true;
+ @XmlElement(defaultValue = "DEFAULT")
+ @XmlSchemaType(name = "string")
+ protected DiagnosticsConnection diagnosticsConnection = DiagnosticsConnection.DEFAULT;
@XmlElement(defaultValue = "true")
protected Boolean updateRecordVersion = true;
@XmlElement(defaultValue = "true")
@@ -3763,6 +3766,22 @@ public class Settings
this.diagnosticsLogging = value;
}
+ /**
+ * Whether to activate the DiagnosticsConnection, explicit by DEFAULT, implicit if ON, or turned OFF entirely.
+ *
+ */
+ public DiagnosticsConnection getDiagnosticsConnection() {
+ return diagnosticsConnection;
+ }
+
+ /**
+ * Whether to activate the DiagnosticsConnection, explicit by DEFAULT, implicit if ON, or turned OFF entirely.
+ *
+ */
+ public void setDiagnosticsConnection(DiagnosticsConnection value) {
+ this.diagnosticsConnection = value;
+ }
+
/**
* Whether store(), insert(), and update() methods should update the record version prior to the operation, for use with {@link #executeWithOptimisticLocking}.
*
@@ -6173,6 +6192,15 @@ public class Settings
return this;
}
+ /**
+ * Whether to activate the DiagnosticsConnection, explicit by DEFAULT, implicit if ON, or turned OFF entirely.
+ *
+ */
+ public Settings withDiagnosticsConnection(DiagnosticsConnection value) {
+ setDiagnosticsConnection(value);
+ return this;
+ }
+
public Settings withUpdateRecordVersion(Boolean value) {
setUpdateRecordVersion(value);
return this;
@@ -6875,6 +6903,7 @@ public class Settings
builder.append("executeListenerEndInvocationOrder", executeListenerEndInvocationOrder);
builder.append("executeLogging", executeLogging);
builder.append("diagnosticsLogging", diagnosticsLogging);
+ builder.append("diagnosticsConnection", diagnosticsConnection);
builder.append("updateRecordVersion", updateRecordVersion);
builder.append("updateRecordTimestamp", updateRecordTimestamp);
builder.append("executeWithOptimisticLocking", executeWithOptimisticLocking);
@@ -8069,6 +8098,15 @@ public class Settings
return false;
}
}
+ if (diagnosticsConnection == null) {
+ if (other.diagnosticsConnection!= null) {
+ return false;
+ }
+ } else {
+ if (!diagnosticsConnection.equals(other.diagnosticsConnection)) {
+ return false;
+ }
+ }
if (updateRecordVersion == null) {
if (other.updateRecordVersion!= null) {
return false;
@@ -8873,6 +8911,7 @@ public class Settings
result = ((prime*result)+((executeListenerEndInvocationOrder == null)? 0 :executeListenerEndInvocationOrder.hashCode()));
result = ((prime*result)+((executeLogging == null)? 0 :executeLogging.hashCode()));
result = ((prime*result)+((diagnosticsLogging == null)? 0 :diagnosticsLogging.hashCode()));
+ result = ((prime*result)+((diagnosticsConnection == null)? 0 :diagnosticsConnection.hashCode()));
result = ((prime*result)+((updateRecordVersion == null)? 0 :updateRecordVersion.hashCode()));
result = ((prime*result)+((updateRecordTimestamp == null)? 0 :updateRecordTimestamp.hashCode()));
result = ((prime*result)+((executeWithOptimisticLocking == null)? 0 :executeWithOptimisticLocking.hashCode()));
diff --git a/jOOQ/src/main/java/org/jooq/impl/DiagnosticsConnection.java b/jOOQ/src/main/java/org/jooq/impl/DiagnosticsConnection.java
index fc05c13f74..42b11fb619 100644
--- a/jOOQ/src/main/java/org/jooq/impl/DiagnosticsConnection.java
+++ b/jOOQ/src/main/java/org/jooq/impl/DiagnosticsConnection.java
@@ -42,6 +42,7 @@ import static java.util.Collections.synchronizedMap;
// ...
// ...
// ...
+import static org.jooq.conf.DiagnosticsConnection.OFF;
import static org.jooq.conf.ParamType.FORCE_INDEXED;
import static org.jooq.impl.DSL.count;
import static org.jooq.impl.DSL.noCondition;
@@ -194,7 +195,16 @@ final class DiagnosticsConnection extends DefaultConnection {
);
}
+ final boolean disabled() {
+ return configuration.settings().getDiagnosticsConnection() == OFF;
+ }
+
final String parse(String sql) {
+
+ // [#7398] Don't do anything if the feature is turned OFF
+ if (disabled())
+ return sql;
+
Queries queries = null;
Queries transformed = null;
String normalised;
diff --git a/jOOQ/src/main/java/org/jooq/impl/DiagnosticsStatement.java b/jOOQ/src/main/java/org/jooq/impl/DiagnosticsStatement.java
index 1527ffbf14..f152d253f1 100644
--- a/jOOQ/src/main/java/org/jooq/impl/DiagnosticsStatement.java
+++ b/jOOQ/src/main/java/org/jooq/impl/DiagnosticsStatement.java
@@ -59,7 +59,10 @@ final class DiagnosticsStatement extends DefaultCallableStatement {
@Override
public final ResultSet executeQuery(String sql) throws SQLException {
- return new DiagnosticsResultSet(super.executeQuery(connection.parse(sql)), sql, this, connection);
+ if (connection.disabled())
+ return super.executeQuery(sql);
+ else
+ return new DiagnosticsResultSet(super.executeQuery(connection.parse(sql)), sql, this, connection);
}
@Override
diff --git a/jOOQ/src/main/java/org/jooq/impl/SelectQueryImpl.java b/jOOQ/src/main/java/org/jooq/impl/SelectQueryImpl.java
index b9ece485e0..44c6636f7b 100644
--- a/jOOQ/src/main/java/org/jooq/impl/SelectQueryImpl.java
+++ b/jOOQ/src/main/java/org/jooq/impl/SelectQueryImpl.java
@@ -548,7 +548,7 @@ final class SelectQueryImpl extends AbstractResultQuery imp
result.groupByDistinct = groupByDistinct;
result.having.setWhere(having.getWhere());
if (window != null)
- result.addWindow(window);
+ result.addWindow0(window);
result.qualify.setWhere(qualify.getWhere());
}
@@ -4250,11 +4250,15 @@ final class SelectQueryImpl extends AbstractResultQuery imp
@Override
public final void addWindow(WindowDefinition... definitions) {
- addWindow(Arrays.asList(definitions));
+ addWindow0(Arrays.asList(definitions));
}
@Override
public final void addWindow(Collection extends WindowDefinition> definitions) {
+ addWindow0(definitions);
+ }
+
+ final void addWindow0(Collection extends WindowDefinition> definitions) {
if (window == null)
window = new WindowList();
diff --git a/jOOQ/src/main/resources/org/jooq/xsd/jooq-runtime-3.18.0.xsd b/jOOQ/src/main/resources/org/jooq/xsd/jooq-runtime-3.18.0.xsd
index 42d14ac78a..28a8b41847 100644
--- a/jOOQ/src/main/resources/org/jooq/xsd/jooq-runtime-3.18.0.xsd
+++ b/jOOQ/src/main/resources/org/jooq/xsd/jooq-runtime-3.18.0.xsd
@@ -1088,6 +1088,10 @@ case of which, this defaults to INLINED]]>
+
+
+ DEFAULT, implicit if ON, or turned OFF entirely.]]>
+
@@ -1826,6 +1830,20 @@ Either <input/> or <inputExpression/> must be provided]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+