db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From krist...@apache.org
Subject svn commit: r631217 - /db/derby/code/trunk/java/client/org/apache/derby/client/am/stmtcache/StatementKey.java
Date Tue, 26 Feb 2008 14:02:32 GMT
Author: kristwaa
Date: Tue Feb 26 06:02:31 2008
New Revision: 631217

URL: http://svn.apache.org/viewvc?rev=631217&view=rev
Log:
DERBY-3438: Allow SQL query text to be null in StatementKey.
Patch file: derby-3438-1a-allow_sql_null.diff

Modified:
    db/derby/code/trunk/java/client/org/apache/derby/client/am/stmtcache/StatementKey.java

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/stmtcache/StatementKey.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/am/stmtcache/StatementKey.java?rev=631217&r1=631216&r2=631217&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/stmtcache/StatementKey.java
(original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/stmtcache/StatementKey.java
Tue Feb 26 06:02:31 2008
@@ -67,17 +67,14 @@
      * @param rsHoldability result set holdability
      * @param autogeneratedKeys if auto-generated keys are returned
      *
-     * @throws IllegalArgumentException if <code>sql</code> and/or
-     *      <code>schema</code> is <code>null</code>
+     * @throws IllegalArgumentException if {@code schema} is {@code null}
      */
     StatementKey(boolean isCallableStatement, String sql, String schema,
             int rsType, int rsConcurrency, int rsHoldability,
             int autogeneratedKeys) {
-        if (sql == null || schema == null) {
+        if (schema == null) {
             // Not localized (yet), because this should never reach the user.
-            throw new IllegalArgumentException(
-                    "sql and/or schema is <null>: sql=" + (sql == null) +
-                    ", schema=" + (schema == null));
+            throw new IllegalArgumentException("schema is <null>");
         }
         this.isCallableStatement = isCallableStatement;
         this.sql = sql;
@@ -125,6 +122,9 @@
         if (!this.schema.equals(other.schema)) {
             return false;
         }
+        if (this.sql == null && other.sql != null) {
+            return false;
+        }
         if (!this.sql.equals(other.sql)) {
             return false;
         }
@@ -140,7 +140,7 @@
     public int hashCode() {
         int hash = 7;
         hash = 47 * hash + (this.isCallableStatement ? 1 : 0);
-        hash = 47 * hash + this.sql.hashCode();
+        hash = 47 * hash + (this.sql == null ? 3 : this.sql.hashCode());
         hash = 47 * hash + this.schema.hashCode();
         hash = 47 * hash + this.type;
         hash = 47 * hash + this.concurrency;



Mime
View raw message