db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From be...@apache.org
Subject svn commit: r358560 - /db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAConnThread.java
Date Thu, 22 Dec 2005 12:29:43 GMT
Author: bernt
Date: Thu Dec 22 04:29:35 2005
New Revision: 358560

URL: http://svn.apache.org/viewcvs?rev=358560&view=rev
Log:
DERBY-774 DRDAConnThread::doneData should use statically allocated SQLException objects. Submitted
by Dyre.Tjeldvoll@Sun.COM

Modified:
    db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAConnThread.java

Modified: db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAConnThread.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAConnThread.java?rev=358560&r1=358559&r2=358560&view=diff
==============================================================================
--- db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAConnThread.java (original)
+++ db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAConnThread.java Thu Dec 22
04:29:35 2005
@@ -6279,6 +6279,19 @@
 		writer.endDdmAndDss();
 		return true;
 	}
+    
+    // The use of static exception objects is normally a bad idea,
+    // but qryscraft_ and notQryscraft_ are not true exceptions and
+    // will not be thrown. They are being used as containers for
+    // passing data to the writeSQLCAGRP() method, and since this
+    // happens frequently we would like to avoid creating a new
+    // SQLException each time, (which is expensive because the
+    // Throwable ctor will fill in the stack trace).
+    private static final SQLException qryscraft_ = 
+        new SQLException("End of Data", "00000");
+    private static final SQLException notQryscraft_ =
+        new SQLException("End of Data", "02000");
+
 	/**
 	 * Done data
 	 * Send SQLCARD for the end of the data
@@ -6333,9 +6346,8 @@
 		boolean isQRYSCRAFT = (stmt.getQryscrorn() == CodePoint.QRYSCRAFT);
 
 		// sqlstate 02000 for end of data.
-		// RESOLVE: Need statics for sqlcodes.
-		writeSQLCAGRP(new SQLException("End of Data", (isQRYSCRAFT ? "00000" : "02000")),
-							(isQRYSCRAFT ? 0 : 100), 0, stmt.rowCount);
+        writeSQLCAGRP((isQRYSCRAFT ? qryscraft_ : notQryscraft_),
+                      (isQRYSCRAFT ? 0 : 100), 0, stmt.rowCount);
 
 		writer.writeByte(CodePoint.NULLDATA);
 		// does all this fit in one QRYDTA



Mime
View raw message