diff --git a/jOOQ/src/main/java/org/jooq/DiagnosticsListener.java b/jOOQ/src/main/java/org/jooq/DiagnosticsListener.java index 293c41957e..fb67e2c839 100644 --- a/jOOQ/src/main/java/org/jooq/DiagnosticsListener.java +++ b/jOOQ/src/main/java/org/jooq/DiagnosticsListener.java @@ -41,12 +41,25 @@ import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; +import org.jooq.conf.DiagnosticsConnection; import org.jooq.conf.Settings; import org.jooq.impl.DSL; +import org.jooq.impl.LoggingDiagnosticsListener; import org.jooq.impl.ParserException; /** * A diagnostics listener. + *
+ * Users can implement this in order to receive and handle diagnostics events + * explicitly. A default implementation is available via + * {@link LoggingDiagnosticsListener}, which can be activated using + * {@link Settings#isDiagnosticsLogging()}. + *
+ * Events are received on any {@link DSLContext#diagnosticsConnection()} or
+ * {@link DSLContext#diagnosticsDataSource()}, if
+ * {@link Settings#getDiagnosticsConnection()} is not turned
+ * {@link DiagnosticsConnection#OFF}. Use {@link DiagnosticsConnection#ON} to
+ * turn diagnostics on for all of jOOQ's {@link ConnectionProvider} usage.
*
* @author Lukas Eder
*/
@@ -62,6 +75,9 @@ public interface DiagnosticsListener {
* Typically, this problem can be remedied by applying the appropriate
* LIMIT clause in SQL, or
* {@link SelectLimitStep#limit(Number)} clause in jOOQ.
+ *
+ * This diagnostic can be turned off using + * {@link Settings#isDiagnosticsTooManyRowsFetched()}. * * @param ctx The context containing information about the diagnostic. */ @@ -76,6 +92,9 @@ public interface DiagnosticsListener { *
* Typically, this problem can be remedied by not running a
* SELECT * query when this isn't strictly required.
+ *
+ * This diagnostic can be turned off using + * {@link Settings#isDiagnosticsTooManyColumnsFetched()}. * * @param ctx The context containing information about the diagnostic. */ @@ -85,6 +104,9 @@ public interface DiagnosticsListener { * The fetched JDBC {@link ResultSet} returned a value for a column, on * which {@link ResultSet#wasNull()} was called unnecessarily (more than * once, or for a non-primitive type). + *
+ * This diagnostic can be turned off using + * {@link Settings#isDiagnosticsUnnecessaryWasNullCall()}. * * @param ctx The context containing information about the diagnostic. */ @@ -94,6 +116,9 @@ public interface DiagnosticsListener { * The fetched JDBC {@link ResultSet} returned a primitive type value for a * column, which could have been null, but {@link ResultSet#wasNull()} was * not called. + *
+ * This diagnostic can be turned off using + * {@link Settings#isDiagnosticsMissingWasNullCall()}. * * @param ctx The context containing information about the diagnostic. */ @@ -115,36 +140,54 @@ public interface DiagnosticsListener { *
*
- *
+ *
+ *
+ *
* SELECT * FROM actor;
* SELECT * FROM actor;
- *
+ *
+ *
* *
- *
+ *
+ *
+ *
* SELECT * FROM actor WHERE id = 1;
* SELECT * FROM actor WHERE id = 2;
- *
+ *
+ *
* *
- *
+ *
+ *
+ *
* SELECT a1.* FROM actor a1 WHERE id = ?;
* SELECT * FROM actor a2 WHERE a2.id = ?;
- *
+ *
+ *
* * Examples of identical statements (which are not considered duplicate, but * {@link #repeatedStatements(DiagnosticsContext)}, if on the same * {@link Connection}) are: *
- *
+ *
+ *
+ *
* SELECT * FROM actor WHERE id = ?;
* SELECT * FROM actor WHERE id = ?;
- *
+ *
+ *
* * This is a system-wide diagnostic that is not specific to individual * {@link Connection} instances. + *
+ * This diagnostic can be turned off using + * {@link Settings#isDiagnosticsDuplicateStatements()}. + *
+ * Advanced duplicate statement recognition can be turned off using + * {@link Settings#isDiagnosticsDuplicateStatementsUsingTransformPatterns()}. * * @param ctx The context containing information about the diagnostic. */ @@ -186,6 +229,9 @@ public interface DiagnosticsListener { *
* This is a {@link Connection}-specific diagnostic that is reset every time * {@link Connection#close()} is called. + *
+ * This diagnostic can be turned off using + * {@link Settings#isDiagnosticsRepeatedStatements()}. * * @param ctx The context containing information about the diagnostic. */ @@ -274,6 +320,68 @@ public interface DiagnosticsListener { + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/jOOQ/src/main/java/org/jooq/conf/Settings.java b/jOOQ/src/main/java/org/jooq/conf/Settings.java index 9aea87683d..ecb3f161ac 100644 --- a/jOOQ/src/main/java/org/jooq/conf/Settings.java +++ b/jOOQ/src/main/java/org/jooq/conf/Settings.java @@ -127,6 +127,8 @@ public class Settings @XmlElement(defaultValue = "true") protected Boolean diagnosticsConsecutiveAggregation = true; @XmlElement(defaultValue = "true") + protected Boolean diagnosticsConcatenationInPredicates = true; + @XmlElement(defaultValue = "true") protected Boolean diagnosticsTooManyColumnsFetched = true; @XmlElement(defaultValue = "true") protected Boolean diagnosticsTooManyRowsFetched = true; @@ -1440,6 +1442,35 @@ public class Settings this.diagnosticsConsecutiveAggregation = value; } + /** + * Whether to run the {@link org.jooq.DiagnosticsListener#concatenationInPredicates(org.jooq.DiagnosticsContext) diagnostic. + *
+ * Diagnostics are turned off if no {@link org.jooq.Configuration#diagnosticsListenerProviders()} are configured. + * Once configured, this diagnostic is turned on by default. + *
+ * This feature is available in the commercial distribution only. + * + * @return + * possible object is + * {@link Boolean } + * + */ + public Boolean isDiagnosticsConcatenationInPredicates() { + return diagnosticsConcatenationInPredicates; + } + + /** + * Sets the value of the diagnosticsConcatenationInPredicates property. + * + * @param value + * allowed object is + * {@link Boolean } + * + */ + public void setDiagnosticsConcatenationInPredicates(Boolean value) { + this.diagnosticsConcatenationInPredicates = value; + } + /** * Whether to run the {@link org.jooq.DiagnosticsListener#tooManyColumnsFetched(org.jooq.DiagnosticsContext) diagnostic. *
@@ -5641,6 +5672,11 @@ public class Settings
return this;
}
+ public Settings withDiagnosticsConcatenationInPredicates(Boolean value) {
+ setDiagnosticsConcatenationInPredicates(value);
+ return this;
+ }
+
public Settings withDiagnosticsTooManyColumnsFetched(Boolean value) {
setDiagnosticsTooManyColumnsFetched(value);
return this;
@@ -6819,6 +6855,7 @@ public class Settings
builder.append("diagnosticsMissingWasNullCall", diagnosticsMissingWasNullCall);
builder.append("diagnosticsRepeatedStatements", diagnosticsRepeatedStatements);
builder.append("diagnosticsConsecutiveAggregation", diagnosticsConsecutiveAggregation);
+ builder.append("diagnosticsConcatenationInPredicates", diagnosticsConcatenationInPredicates);
builder.append("diagnosticsTooManyColumnsFetched", diagnosticsTooManyColumnsFetched);
builder.append("diagnosticsTooManyRowsFetched", diagnosticsTooManyRowsFetched);
builder.append("diagnosticsUnnecessaryWasNullCall", diagnosticsUnnecessaryWasNullCall);
@@ -7342,6 +7379,15 @@ public class Settings
return false;
}
}
+ if (diagnosticsConcatenationInPredicates == null) {
+ if (other.diagnosticsConcatenationInPredicates!= null) {
+ return false;
+ }
+ } else {
+ if (!diagnosticsConcatenationInPredicates.equals(other.diagnosticsConcatenationInPredicates)) {
+ return false;
+ }
+ }
if (diagnosticsTooManyColumnsFetched == null) {
if (other.diagnosticsTooManyColumnsFetched!= null) {
return false;
@@ -8827,6 +8873,7 @@ public class Settings
result = ((prime*result)+((diagnosticsMissingWasNullCall == null)? 0 :diagnosticsMissingWasNullCall.hashCode()));
result = ((prime*result)+((diagnosticsRepeatedStatements == null)? 0 :diagnosticsRepeatedStatements.hashCode()));
result = ((prime*result)+((diagnosticsConsecutiveAggregation == null)? 0 :diagnosticsConsecutiveAggregation.hashCode()));
+ result = ((prime*result)+((diagnosticsConcatenationInPredicates == null)? 0 :diagnosticsConcatenationInPredicates.hashCode()));
result = ((prime*result)+((diagnosticsTooManyColumnsFetched == null)? 0 :diagnosticsTooManyColumnsFetched.hashCode()));
result = ((prime*result)+((diagnosticsTooManyRowsFetched == null)? 0 :diagnosticsTooManyRowsFetched.hashCode()));
result = ((prime*result)+((diagnosticsUnnecessaryWasNullCall == null)? 0 :diagnosticsUnnecessaryWasNullCall.hashCode()));
diff --git a/jOOQ/src/main/java/org/jooq/impl/DiagnosticsConnection.java b/jOOQ/src/main/java/org/jooq/impl/DiagnosticsConnection.java
index c7c407691d..cf0bed9921 100644
--- a/jOOQ/src/main/java/org/jooq/impl/DiagnosticsConnection.java
+++ b/jOOQ/src/main/java/org/jooq/impl/DiagnosticsConnection.java
@@ -73,7 +73,12 @@ import org.jooq.RenderContext;
// ...
import org.jooq.Select;
import org.jooq.conf.Settings;
+import org.jooq.impl.QOM.CompareCondition;
+import org.jooq.impl.QOM.Concat;
import org.jooq.impl.QOM.Eq;
+import org.jooq.impl.QOM.In;
+import org.jooq.impl.QOM.InList;
+import org.jooq.impl.QOM.NotInList;
import org.jooq.tools.jdbc.DefaultConnection;
/**
@@ -300,6 +305,16 @@ final class DiagnosticsConnection extends DefaultConnection {
+
+
+
+
+
+
+
+
+
+
@@ -334,6 +349,27 @@ final class DiagnosticsConnection extends DefaultConnection {
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
private final Set
+This feature is available in the commercial distribution only.]]>