db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From myrn...@apache.org
Subject svn commit: r1520181 - in /db/derby/code/branches/10.10/java: client/org/apache/derby/client/am/ client/org/apache/derby/client/net/ engine/org/apache/derby/iapi/services/info/ engine/org/apache/derby/impl/jdbc/ testing/org/apache/derbyTesting/function...
Date Thu, 05 Sep 2013 00:37:19 GMT
Author: myrnavl
Date: Thu Sep  5 00:37:18 2013
New Revision: 1520181

URL: http://svn.apache.org/r1520181
Log:
DERBY-6324; DatabaseMetaData.getJDBCMinorVersion() should return 2 now that we've implemented
JDBC 4.2
  Backport of the fix of revision 1519785 to 10.10; 
  A straight merge was not possible because more jvm versions are supported in 10.10.

Modified:
    db/derby/code/branches/10.10/java/client/org/apache/derby/client/am/DatabaseMetaData.java
    db/derby/code/branches/10.10/java/client/org/apache/derby/client/net/NetDatabaseMetaData40.java
    db/derby/code/branches/10.10/java/engine/org/apache/derby/iapi/services/info/JVMInfo.java
    db/derby/code/branches/10.10/java/engine/org/apache/derby/impl/jdbc/EmbedDatabaseMetaData40.java
    db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/DatabaseMetaDataTest.java

Modified: db/derby/code/branches/10.10/java/client/org/apache/derby/client/am/DatabaseMetaData.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.10/java/client/org/apache/derby/client/am/DatabaseMetaData.java?rev=1520181&r1=1520180&r2=1520181&view=diff
==============================================================================
--- db/derby/code/branches/10.10/java/client/org/apache/derby/client/am/DatabaseMetaData.java
(original)
+++ db/derby/code/branches/10.10/java/client/org/apache/derby/client/am/DatabaseMetaData.java
Thu Sep  5 00:37:18 2013
@@ -24,6 +24,7 @@ package org.apache.derby.client.am;
 import java.sql.SQLException;
 
 import org.apache.derby.shared.common.reference.SQLState;
+import org.apache.derby.iapi.services.info.JVMInfo;
 
 // Note:
 //   Tag members using the strictest visibility.
@@ -2275,7 +2276,7 @@ public abstract class DatabaseMetaData i
 
     public int getJDBCMinorVersion() throws SQLException {
         checkForClosedConnection();
-        return 0;
+        return JVMInfo.jdbcMinorVersion();
     }
 
     public int getSQLStateType() throws SQLException {

Modified: db/derby/code/branches/10.10/java/client/org/apache/derby/client/net/NetDatabaseMetaData40.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.10/java/client/org/apache/derby/client/net/NetDatabaseMetaData40.java?rev=1520181&r1=1520180&r2=1520181&view=diff
==============================================================================
--- db/derby/code/branches/10.10/java/client/org/apache/derby/client/net/NetDatabaseMetaData40.java
(original)
+++ db/derby/code/branches/10.10/java/client/org/apache/derby/client/net/NetDatabaseMetaData40.java
Thu Sep  5 00:37:18 2013
@@ -26,6 +26,7 @@ import java.sql.SQLException;
 import org.apache.derby.client.am.ClientMessageId;
 import org.apache.derby.client.am.SqlException;
 import org.apache.derby.shared.common.reference.SQLState;
+import org.apache.derby.iapi.services.info.JVMInfo;
 
 public class NetDatabaseMetaData40 extends org.apache.derby.client.net.NetDatabaseMetaData
{
     
@@ -51,7 +52,8 @@ public class NetDatabaseMetaData40 exten
      */
     public int getJDBCMinorVersion() throws SQLException {
         checkForClosedConnection();
-        return 1;
+        //return 1;
+        return JVMInfo.jdbcMinorVersion();
     }
 
     /**

Modified: db/derby/code/branches/10.10/java/engine/org/apache/derby/iapi/services/info/JVMInfo.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.10/java/engine/org/apache/derby/iapi/services/info/JVMInfo.java?rev=1520181&r1=1520180&r2=1520181&view=diff
==============================================================================
--- db/derby/code/branches/10.10/java/engine/org/apache/derby/iapi/services/info/JVMInfo.java
(original)
+++ db/derby/code/branches/10.10/java/engine/org/apache/derby/iapi/services/info/JVMInfo.java
Thu Sep  5 00:37:18 2013
@@ -61,6 +61,36 @@ 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()
+    { 
+        switch (JDK_ID)
+        { 
+        case J2SE_14: return 3; 
+        case J2SE_142: return 3; 
+        case J2SE_15: return 3; 
+        case J2SE_16: return 4; 
+        case J2SE_17: return 4; 
+        case J2SE_18: 
+        default: return 4;
+        }
+    }
+
+    public static int jdbcMinorVersion()
+    {
+        switch (JDK_ID)
+        { 
+        case J2SE_14: return 0; 
+        case J2SE_142: return 0; 
+        case J2SE_15: return 0; 
+        case J2SE_16: return 0; 
+        case J2SE_17: return 1; 
+        case J2SE_18: 
+        default: return 2; 
+        }
+    } 
+
+
 	public static final boolean J2ME;
 
 	static 
@@ -175,14 +205,15 @@ public abstract class JVMInfo
 	*/
 	public static String derbyVMLevel()
 	{
+		String jdbcVersion = jdbcMajorVersion() + "." + jdbcMinorVersion();
 		switch (JDK_ID)
 		{
-		case J2SE_14: return J2ME ? "J2ME - JDBC for CDC/FP 1.1" : "J2SE 1.4 - JDBC 3.0";
-		case J2SE_142: return "J2SE 1.4.2 - JDBC 3.0";
-		case J2SE_15: return "J2SE 5.0 - JDBC 3.0";
-        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_14: return J2ME ? "J2ME - JDBC for CDC/FP 1.1" : "J2SE 1.4 - JDBC " + jdbcVersion;
+		case J2SE_142: return "J2SE 1.4.2 - JDBC " + jdbcVersion;
+		case J2SE_15: return "J2SE 5.0 - JDBC " + jdbcVersion;
+        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/branches/10.10/java/engine/org/apache/derby/impl/jdbc/EmbedDatabaseMetaData40.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.10/java/engine/org/apache/derby/impl/jdbc/EmbedDatabaseMetaData40.java?rev=1520181&r1=1520180&r2=1520181&view=diff
==============================================================================
--- db/derby/code/branches/10.10/java/engine/org/apache/derby/impl/jdbc/EmbedDatabaseMetaData40.java
(original)
+++ db/derby/code/branches/10.10/java/engine/org/apache/derby/impl/jdbc/EmbedDatabaseMetaData40.java
Thu Sep  5 00:37:18 2013
@@ -24,6 +24,7 @@ package org.apache.derby.impl.jdbc;
 import java.sql.RowIdLifetime;
 import java.sql.SQLException;
 import org.apache.derby.iapi.reference.SQLState;
+import org.apache.derby.iapi.services.info.JVMInfo;
 
 public class EmbedDatabaseMetaData40 extends EmbedDatabaseMetaData {
     
@@ -46,7 +47,7 @@ public class EmbedDatabaseMetaData40 ext
      * @return JDBC version minor number
      */
     public int getJDBCMinorVersion() {
-        return 1;
+        return JVMInfo.jdbcMinorVersion();
     }
 
     public RowIdLifetime getRowIdLifetime() throws SQLException {

Modified: db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/DatabaseMetaDataTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/DatabaseMetaDataTest.java?rev=1520181&r1=1520180&r2=1520181&view=diff
==============================================================================
--- db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/DatabaseMetaDataTest.java
(original)
+++ db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/DatabaseMetaDataTest.java
Thu Sep  5 00:37:18 2013
@@ -690,11 +690,21 @@ public class DatabaseMetaDataTest extend
         
         int expectedJDBCMajor = -1;
         int expectedJDBCMinor = -1;
-        if (JDBC.vmSupportsJDBC4())
+        if (JDBC.vmSupportsJDBC42())
+        {
+            expectedJDBCMajor = 4;
+            expectedJDBCMinor = 2;
+        }
+        else if (JDBC.vmSupportsJDBC41())
         {
             expectedJDBCMajor = 4;
             expectedJDBCMinor = 1;
         }
+        else if (JDBC.vmSupportsJDBC4())
+        {
+            expectedJDBCMajor = 4;
+            expectedJDBCMinor = 0;
+        }
         else if (JDBC.vmSupportsJDBC3())
         {
             expectedJDBCMajor = 3;



Mime
View raw message