From: Mark R. <mro...@us...> - 2011-10-27 10:49:45
|
Update of /cvsroot/firebird/client-java/src/jdbc_40/org/firebirdsql/jdbc In directory vz-cvs-3.sog:/tmp/cvs-serv9772/src/jdbc_40/org/firebirdsql/jdbc Modified Files: FBDatabaseMetaData.java Log Message: Update some of the information returned Index: FBDatabaseMetaData.java =================================================================== RCS file: /cvsroot/firebird/client-java/src/jdbc_40/org/firebirdsql/jdbc/FBDatabaseMetaData.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- FBDatabaseMetaData.java 25 Sep 2011 08:52:49 -0000 1.4 +++ FBDatabaseMetaData.java 27 Oct 2011 10:49:42 -0000 1.5 @@ -18,6 +18,8 @@ */ package org.firebirdsql.jdbc; +import java.security.AccessController; +import java.security.PrivilegedAction; import java.sql.ResultSet; import java.sql.RowIdLifetime; import java.sql.SQLException; @@ -71,4 +73,28 @@ // TODO Double check if this is correct return false; } + + public int getJDBCMajorVersion() { + return 4; + } + + public int getJDBCMinorVersion() { + try { + String javaImplementation = AccessController.doPrivileged(new PrivilegedAction<String>() { + public String run() { + return System.getProperty("java.implementation.version"); + } + }); + if (javaImplementation != null && "1.7".compareTo(javaImplementation) <= 0) { + // JDK 1.7 or higher: JDBC 4.1 + return 1; + } else { + // JDK 1.6 (or lower): JDBC 4.0 + return 0; + } + } catch (RuntimeException ex) { + // default to 0 (JDBC 4.0) when privileged call fails + return 0; + } + } } |