When Wonder detects a long running query it logs the SQL and bindings. If the binding is a NSTimestamp the log shows null. See example below.
"EntityName"@4113761 _expression_ took 11022 ms: SELECT t0.COLX, ... FROM TABLE_1 t0, TABLE_2 T1 WHERE (T1.PROVIDER_ID = ? AND T1.DATE_DELETED is NULL AND T1.IS_LATEST = ? AND t0.USER_GROUP_ID = ? AND T1.PATIENT_ID = ? AND t0.START_DATE = ?) AND t0.ENCOUNTER_ID
= T1.ENCOUNTER_ID withBindings: 1:###[providerID], 2:###[isLatest], 3:###[userGroupID], 4:####[patientID], 5:NULL[startDate]
java.lang.RuntimeException: Statement running too long
I made a minor change to ERXEOAccessUtilities.createLogString() to log the NSTimestamp value. Below is the patch, can someone review and apply the patch please?
Index: Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/eof/ERXEOAccessUtilities.java
===================================================================
--- Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/eof/ERXEOAccessUtilities.java
(revision 3)
+++ Wonder/Frameworks/Core/ERExtensions/Sources/er/extensions/eof/ERXEOAccessUtilities.java
(working copy)
@@ -58,6 +58,7 @@
import com.webobjects.foundation.NSMutableDictionary;
import com.webobjects.foundation.NSMutableSet;
import com.webobjects.foundation.NSSet;
+import com.webobjects.foundation.NSTimestamp;
import com.webobjects.foundation._NSDelegate;
import com.webobjects.jdbcadaptor.JDBCPlugIn;
@@ -1243,6 +1244,8 @@
obj = EOSQLExpression.sqlStringForString((String) obj);
} else if (obj instanceof Number) {
obj = EOSQLExpression.sqlStringForNumber((Number) obj);
+
} else if (obj instanceof NSTimestamp) {
+
obj = obj.toString();
} else if (obj instanceof NSData) {
// ak: this is just for logging, however we would
// like to get readable data