db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kahat...@apache.org
Subject svn commit: r393164 - in /db/derby/code/trunk/java: build/org/apache/derbyBuild/ client/org/apache/derby/client/am/ engine/org/apache/derby/loc/ shared/org/apache/derby/shared/common/reference/
Date Tue, 11 Apr 2006 09:10:36 GMT
Author: kahatlen
Date: Tue Apr 11 02:10:34 2006
New Revision: 393164

URL: http://svn.apache.org/viewcvs?rev=393164&view=rev
Log:
Partial patch for DERBY-924, DERBY-925 and DERBY-970.

New method added: DatabaseMetaData.checkServerJdbcVersionX() - checks
whether the server supports a given JDBC version. Throws an exception
if it doesn't.

Contributed by Dyre Tjeldvoll <Dyre.Tjeldvoll@Sun.COM>.

Modified:
    db/derby/code/trunk/java/build/org/apache/derbyBuild/splitmessages.java
    db/derby/code/trunk/java/client/org/apache/derby/client/am/DatabaseMetaData.java
    db/derby/code/trunk/java/engine/org/apache/derby/loc/messages_en.properties
    db/derby/code/trunk/java/shared/org/apache/derby/shared/common/reference/SQLState.java

Modified: db/derby/code/trunk/java/build/org/apache/derbyBuild/splitmessages.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/build/org/apache/derbyBuild/splitmessages.java?rev=393164&r1=393163&r2=393164&view=diff
==============================================================================
--- db/derby/code/trunk/java/build/org/apache/derbyBuild/splitmessages.java (original)
+++ db/derby/code/trunk/java/build/org/apache/derbyBuild/splitmessages.java Tue Apr 11 02:10:34
2006
@@ -70,6 +70,7 @@
         clientMessageIds.add("J104");
         clientMessageIds.add(SQLState.HOLDABLE_RESULT_SET_NOT_AVAILABLE);
         clientMessageIds.add(SQLState.JDBC_METHOD_NOT_IMPLEMENTED);
+        clientMessageIds.add(SQLState.JDBC_METHOD_NOT_SUPPORTED_BY_SERVER);
         clientMessageIds.add(SQLState.DRDA_NO_AUTOCOMMIT_UNDER_XA);
         clientMessageIds.add(SQLState.DRDA_INVALID_XA_STATE_ON_COMMIT_OR_ROLLBACK);
         clientMessageIds.add(SQLState.HOLDABLE_RESULT_SET_NOT_AVAILABLE);

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/DatabaseMetaData.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/client/org/apache/derby/client/am/DatabaseMetaData.java?rev=393164&r1=393163&r2=393164&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/DatabaseMetaData.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/DatabaseMetaData.java Tue Apr
11 02:10:34 2006
@@ -63,6 +63,11 @@
 
     public ProductLevel productLevel_;
 
+    /** The JDBC major version supported by the server. */
+    private final int serverJdbcMajorVersion;
+    /** The JDBC minor version supported by the server. */
+    private final int serverJdbcMinorVersion;
+
     private ResultSet lastGetColumnPrivilegesResultSet_ = null;
     private ResultSet lastGetColumnsResultSet_ = null;
     private ResultSet lastGetForeignKeysResultSet_ = null;
@@ -91,6 +96,13 @@
         if (connection.isXAConnection()) {
             connection.xaHostVersion_ = productLevel_.versionLevel_;
         }
+        if (productLevel_.lessThan(10, 2, 0)) {
+            serverJdbcMajorVersion = 3;
+            serverJdbcMinorVersion = 0;
+        } else {
+            serverJdbcMajorVersion = 4;
+            serverJdbcMinorVersion = 0;
+        }
     }
 
     // ---------------------------jdbc 1------------------------------------------
@@ -2395,6 +2407,30 @@
 
         } else {
             agent_.checkForDeferredExceptions();
+        }
+    }
+
+    /**
+     * Checks whether the server supports a JDBC version. If the
+     * server does not support the JDBC version, an exception is
+     * thrown.
+     *
+     * @param method name of the method for which support is needed on
+     * the server (used in exception message)
+     * @param major minimum JDBC major version
+     * @param minor minimum JDBC minor version if major version matches
+     * @exception SqlException if the server does not support the
+     * specified JDBC version
+     */
+    protected void checkServerJdbcVersionX(String method, int major, int minor)
+        throws SqlException
+    {
+        if (serverJdbcMajorVersion < major ||
+            (serverJdbcMajorVersion == major &&
+             serverJdbcMinorVersion < minor)) {
+            MessageId mid =
+                new MessageId(SQLState.JDBC_METHOD_NOT_SUPPORTED_BY_SERVER);
+            throw new SqlException(agent_.logWriter_, mid, method);
         }
     }
 }

Modified: db/derby/code/trunk/java/engine/org/apache/derby/loc/messages_en.properties
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/loc/messages_en.properties?rev=393164&r1=393163&r2=393164&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/loc/messages_en.properties (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/loc/messages_en.properties Tue Apr 11
02:10:34 2006
@@ -1165,6 +1165,7 @@
 #0A - feature not implemented
 0A000.S=Feature not implemented: {0}.
 0A000.S.1=JDBC method is not yet implemented.
+0A000.S.2=JDBC method {0} is not supported by the server. Please upgrade the server.
 
 XJ004.C=Database ''{0}'' not found.
 A020=Invalid authentication.

Modified: db/derby/code/trunk/java/shared/org/apache/derby/shared/common/reference/SQLState.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/shared/org/apache/derby/shared/common/reference/SQLState.java?rev=393164&r1=393163&r2=393164&view=diff
==============================================================================
--- db/derby/code/trunk/java/shared/org/apache/derby/shared/common/reference/SQLState.java
(original)
+++ db/derby/code/trunk/java/shared/org/apache/derby/shared/common/reference/SQLState.java
Tue Apr 11 02:10:34 2006
@@ -1351,6 +1351,7 @@
 
     String NOT_IMPLEMENTED                                          = "0A000.S";
     String JDBC_METHOD_NOT_IMPLEMENTED                              = "0A000.S.1";
+    String JDBC_METHOD_NOT_SUPPORTED_BY_SERVER                      = "0A000.S.2";
 
 	
 



Mime
View raw message