db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From myrn...@apache.org
Subject svn commit: r1519785 - in /db/derby/code/trunk/java: client/org/apache/derby/client/am/ engine/org/apache/derby/iapi/services/info/ engine/org/apache/derby/impl/jdbc/ testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ testing/org/apache/derby...
Date Tue, 03 Sep 2013 18:29:11 GMT
Author: myrnavl
Date: Tue Sep  3 18:29:11 2013
New Revision: 1519785

URL: http://svn.apache.org/r1519785
Log:
DERBY-6324; DatabaseMetaData.getJDBCMinorVersion() should return 2 now that we've implemented
JDBC 4.2
  Adding logic to JVMInfo to identify the supported JDBC level based on the 
  (currently supported) JVM versions, which then is used in the client and embedded drivers.
  Tests are changed to reflect this.

Modified:
    db/derby/code/trunk/java/client/org/apache/derby/client/am/ClientDatabaseMetaData.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/info/JVMInfo.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedDatabaseMetaData.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/DatabaseMetaDataTest.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/SysinfoCPCheckTest.java

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/ClientDatabaseMetaData.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/am/ClientDatabaseMetaData.java?rev=1519785&r1=1519784&r2=1519785&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/ClientDatabaseMetaData.java
(original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/ClientDatabaseMetaData.java
Tue Sep  3 18:29:11 2013
@@ -29,6 +29,7 @@ import java.sql.SQLException;
 import java.sql.Types;
 import java.util.StringTokenizer;
 
+import org.apache.derby.iapi.services.info.JVMInfo;
 import org.apache.derby.shared.common.reference.SQLState;
 
 // Note:
@@ -124,6 +125,8 @@ public abstract class ClientDatabaseMeta
             serverJdbcMajorVersion = 3;
             serverJdbcMinorVersion = 0;
         } else {
+            // this value is only used to check that we have at least 4.0; 
+            // higher is irrelevant
             serverJdbcMajorVersion = 4;
             serverJdbcMinorVersion = 0;
         }
@@ -2301,7 +2304,7 @@ public abstract class ClientDatabaseMeta
 
     public int getJDBCMinorVersion() throws SQLException {
         checkForClosedConnection();
-        return 1;
+        return JVMInfo.jdbcMinorVersion();
     }
 
     public int getSQLStateType() throws SQLException {

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/info/JVMInfo.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/info/JVMInfo.java?rev=1519785&r1=1519784&r2=1519785&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/info/JVMInfo.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/info/JVMInfo.java Tue Sep
 3 18:29:11 2013
@@ -58,6 +58,22 @@ public abstract class JVMInfo
     public static final int J2SE_17 = 8; // Java SE 7
     public static final int J2SE_18 = 9;
 
+    public static int jdbcMajorVersion()
+    { 
+        return 4; 
+    }
+
+    public static int jdbcMinorVersion()
+    {
+        switch (JDK_ID)
+        { 
+        case J2SE_16: return 0; 
+        case J2SE_17: return 1; 
+        case J2SE_18: 
+        default: return 2; 
+        }
+    } 
+
 	static 
 	{
 		int id;
@@ -118,11 +134,12 @@ public abstract class JVMInfo
 	*/
 	public static String derbyVMLevel()
 	{
+		String jdbcVersion = jdbcMajorVersion() + "." + jdbcMinorVersion();
 		switch (JDK_ID)
 		{
-        case J2SE_16: return "Java SE 6 - JDBC 4.1";
-        case J2SE_17: return "Java SE 7 - JDBC 4.1";
-        case J2SE_18: return "Java SE 8 - JDBC 4.1";
+        case J2SE_16: return "Java SE 6 - JDBC " + jdbcVersion;
+        case J2SE_17: return "Java SE 7 - JDBC " + jdbcVersion;
+        case J2SE_18: return "Java SE 8 - JDBC " + jdbcVersion;
 		default: return "?-?";
 		}
 	}

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedDatabaseMetaData.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedDatabaseMetaData.java?rev=1519785&r1=1519784&r2=1519785&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedDatabaseMetaData.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedDatabaseMetaData.java
Tue Sep  3 18:29:11 2013
@@ -21,6 +21,7 @@
 
 package org.apache.derby.impl.jdbc;
 
+import org.apache.derby.iapi.services.info.JVMInfo;
 import org.apache.derby.iapi.services.info.ProductVersionHolder;
 
 import org.apache.derby.iapi.services.monitor.Monitor;
@@ -3306,7 +3307,7 @@ public class EmbedDatabaseMetaData exten
 	*/
 	public int getJDBCMinorVersion()
 	{
-        return 1;
+        return JVMInfo.jdbcMinorVersion();
 	}
 
 	/**

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/DatabaseMetaDataTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/DatabaseMetaDataTest.java?rev=1519785&r1=1519784&r2=1519785&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/DatabaseMetaDataTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/DatabaseMetaDataTest.java
Tue Sep  3 18:29:11 2013
@@ -689,20 +689,23 @@ public class DatabaseMetaDataTest extend
         
         int expectedJDBCMajor = -1;
         int expectedJDBCMinor = -1;
-        if (JDBC.vmSupportsJDBC4())
+        // java 8 - jdbc 4.2
+        if (JDBC.vmSupportsJDBC42())
         {
             expectedJDBCMajor = 4;
-            expectedJDBCMinor = 1;
+            expectedJDBCMinor = 2;
         }
-        else if (JDBC.vmSupportsJDBC3())
+        // java 7 - jdbc 4.1
+        else if (JDBC.vmSupportsJDBC41())
         {
-            expectedJDBCMajor = 3;
-            expectedJDBCMinor = 0;
+            expectedJDBCMajor = 4;
+            expectedJDBCMinor = 1;
         }
-        else if (JDBC.vmSupportsJSR169())
+        // java 6 - jdbc 4.0
+        else if (JDBC.vmSupportsJDBC4())
         {
-            // Not sure what is the correct output for JSR 169
-            expectedJDBCMajor = -1;
+            expectedJDBCMajor = 4;
+            expectedJDBCMinor = 0;
         }
          
         if (expectedJDBCMajor != -1)

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/SysinfoCPCheckTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/SysinfoCPCheckTest.java?rev=1519785&r1=1519784&r2=1519785&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/SysinfoCPCheckTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/SysinfoCPCheckTest.java
Tue Sep  3 18:29:11 2013
@@ -233,16 +233,18 @@ public class SysinfoCPCheckTest extends 
   		       JVMInfo.JDK_ID == JVMInfo.J2SE_18 );  
      }
      
+     // Still testing this here although we don't actually put
+     // out this line with sysinfo anymore.
      public void testderbyVMLevel(){
      	switch (JVMInfo.JDK_ID) {
          	case JVMInfo.J2SE_16: 
-         		assertEquals("Java SE 6 - JDBC 4.1",JVMInfo.derbyVMLevel());
+         		assertEquals("Java SE 6 - JDBC 4.0",JVMInfo.derbyVMLevel());
          		break;
          	case JVMInfo.J2SE_17: 
          		assertEquals("Java SE 7 - JDBC 4.1",JVMInfo.derbyVMLevel());
          		break;
          	case JVMInfo.J2SE_18: 
-         		assertEquals("Java SE 8 - JDBC 4.1",JVMInfo.derbyVMLevel());
+         		assertEquals("Java SE 8 - JDBC 4.2",JVMInfo.derbyVMLevel());
          		break;
          	default: 
  			 assertEquals("?-?",JVMInfo.derbyVMLevel());



Mime
View raw message