You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by dj...@apache.org on 2006/03/12 23:27:56 UTC
svn commit: r385377 -
/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/Triggers.java
Author: djd
Date: Sun Mar 12 14:27:55 2006
New Revision: 385377
URL: http://svn.apache.org/viewcvs?rev=385377&view=rev
Log:
DERBY-1102 (partial) Remove application code that printed the trigger information using
non-public apis.
Modified:
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/Triggers.java
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/Triggers.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/Triggers.java?rev=385377&r1=385376&r2=385377&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/Triggers.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/Triggers.java Sun Mar 12 14:27:55 2006
@@ -40,7 +40,6 @@
public static String triggerFiresMinimal(String string) throws Throwable
{
- TriggerExecutionContext tec = Factory.getTriggerExecutionContext();
System.out.println("TRIGGER: " + "<"+string+">");
return "";
}
@@ -154,91 +153,6 @@
"TARGET: workUnitFires" : isReplicationSource() ?
"SOURCE: workUnitFires" :
"<error, not in rep context?!?>"));
- }
-
- public static String printTriggerInfo() throws Throwable
- {
- TriggerExecutionContext tec = Factory.getTriggerExecutionContext();
- int eventType = tec.getEventType();
- String eventName;
-
- switch (eventType)
- {
- case TriggerExecutionContext.UPDATE_EVENT:
- eventName = "UPDATE";
- break;
-
- case TriggerExecutionContext.DELETE_EVENT:
- eventName = "DELETE";
- break;
-
- case TriggerExecutionContext.INSERT_EVENT:
- eventName = "INSERT";
- break;
- default:
- throw new Throwable("unexpected event type: "+eventType);
- }
-
- StringBuffer strbuf = new StringBuffer("TriggerInformation\n------------------\n");
- strbuf.append("getEventStatetmentText(): "+tec.getEventStatementText());
- strbuf.append("\ngetEventType(): "+eventName);
- strbuf.append("\ngetModifiedColumns(): {");
-
- String[] modifiedCols = tec.getModifiedColumns();
- if (modifiedCols == null)
- {
- strbuf.append(" <all> }");
- }
- else
- {
- for (int i = 0; i < modifiedCols.length; i++)
- {
- if (i > 0)
- strbuf.append(", ");
- strbuf.append(modifiedCols[i]);
- }
- strbuf.append("}");
- }
- strbuf.append("\n");
- strbuf.append(getModifiedColumnsCheckInfo(tec));
- System.out.println(strbuf.toString());
- printTriggerChanges();
- return "";
- }
-
- private static String getModifiedColumnsCheckInfo(TriggerExecutionContext tec) throws Throwable
- {
- ResultSet rs = (tec.getNewRowSet() == null) ?
- tec.getOldRowSet() :
- tec.getNewRowSet();
-
- ResultSetMetaData rsmd = rs.getMetaData();
-
- // Get the number of columns in the result set
- int numCols = rsmd.getColumnCount();
-
- StringBuffer msg = new StringBuffer("wasColumnModified() on each column\n\t");
- for (int i=1; i<=numCols; i++)
- {
- if (i > 1)
- {
- msg.append("\n\t");
- }
- msg.append(rsmd.getColumnLabel(i));
- msg.append(":\t");
- boolean wasModified = tec.wasColumnModified(rsmd.getColumnLabel(i));
- if (wasModified != tec.wasColumnModified(i))
- {
- msg.append("ERROR: tec.wasColumnModifed(String) = "+wasModified);
- msg.append("and tec.wasColumnModifed(int) = "+(!wasModified));
- }
- else
- {
- msg.append(wasModified);
- }
- }
- msg.append("\n");
- return msg.toString();
}
// used for performance numbers