diff options
author | Bruce Momjian <bruce@momjian.us> | 2001-10-25 06:00:05 +0000 |
---|---|---|
committer | Bruce Momjian <bruce@momjian.us> | 2001-10-25 06:00:05 +0000 |
commit | d2e27b0674e238a4f94f1c190a395a530746d5d3 (patch) | |
tree | d654e117fdc20ecb84da14052fad5124c9f32012 /src/interfaces/jdbc/utils/CheckVersion.java | |
parent | b81844b1738c584d92330a5ccd0fbd8b603d2886 (diff) | |
download | postgresql-d2e27b0674e238a4f94f1c190a395a530746d5d3.tar.gz postgresql-d2e27b0674e238a4f94f1c190a395a530746d5d3.zip |
pgjindent jdbc files. First time jdbc files were formatted.
Diffstat (limited to 'src/interfaces/jdbc/utils/CheckVersion.java')
-rw-r--r-- | src/interfaces/jdbc/utils/CheckVersion.java | 118 |
1 files changed, 62 insertions, 56 deletions
diff --git a/src/interfaces/jdbc/utils/CheckVersion.java b/src/interfaces/jdbc/utils/CheckVersion.java index 8832543e725..74c40813cdb 100644 --- a/src/interfaces/jdbc/utils/CheckVersion.java +++ b/src/interfaces/jdbc/utils/CheckVersion.java @@ -7,62 +7,68 @@ package utils; */ public class CheckVersion { - /** - * Check for the existence of a class by attempting to load it - */ - public static boolean checkClass(String c) { - try { - Class.forName(c); - } catch(Exception e) { - return false; + /** + * Check for the existence of a class by attempting to load it + */ + public static boolean checkClass(String c) + { + try + { + Class.forName(c); + } + catch (Exception e) + { + return false; + } + return true; } - return true; - } - - /** - * This first checks java.vm.version for 1.1, 1.2 or 1.3. - * - * It writes jdbc1 to stdout for the 1.1.x VM. - * - * For 1.2 or 1.3, it checks for the existence of the javax.sql.DataSource - * interface, and if found writes enterprise to stdout. If the interface - * is not found, it writes jdbc2 to stdout. - * - * PS: It also looks for the existence of java.lang.Byte which appeared in - * JDK1.1.0 incase java.vm.version is not heeded by some JVM's. - * - * If it can't work it out, it writes huho to stdout. - * - * The make file uses the written results to determine which rule to run. - * - * Bugs: This needs thorough testing. - */ - public static void main(String args[]) - { - String vmversion = System.getProperty("java.vm.version"); - - System.out.println("postgresql.jdbc="+System.getProperty("postgresql.jdbc")); - - // We are running a 1.1 JVM - if(vmversion.startsWith("1.1")) { - System.out.println("jdbc1"); - //System.exit(0); - } - else - // We are running a 1.2 or 1.3 JVM - if(vmversion.startsWith("1.2") || - vmversion.startsWith("1.3") || - checkClass("java.lang.Byte") - ) { - - // Check to see if we have the standard extensions. If so, then - // we want the enterprise edition, otherwise the jdbc2 driver. - if(checkClass("javax.sql.DataSource")) - System.out.println("enterprise"); - else - System.out.println("jdbc2"); - //System.exit(0); + + /** + * This first checks java.vm.version for 1.1, 1.2 or 1.3. + * + * It writes jdbc1 to stdout for the 1.1.x VM. + * + * For 1.2 or 1.3, it checks for the existence of the javax.sql.DataSource + * interface, and if found writes enterprise to stdout. If the interface + * is not found, it writes jdbc2 to stdout. + * + * PS: It also looks for the existence of java.lang.Byte which appeared in + * JDK1.1.0 incase java.vm.version is not heeded by some JVM's. + * + * If it can't work it out, it writes huho to stdout. + * + * The make file uses the written results to determine which rule to run. + * + * Bugs: This needs thorough testing. + */ + public static void main(String args[]) + { + String vmversion = System.getProperty("java.vm.version"); + + System.out.println("postgresql.jdbc=" + System.getProperty("postgresql.jdbc")); + + // We are running a 1.1 JVM + if (vmversion.startsWith("1.1")) + { + System.out.println("jdbc1"); + //System.exit(0); + } + else + // We are running a 1.2 or 1.3 JVM + if (vmversion.startsWith("1.2") || + vmversion.startsWith("1.3") || + checkClass("java.lang.Byte") + ) + { + + // Check to see if we have the standard extensions. If so, then + // we want the enterprise edition, otherwise the jdbc2 driver. + if (checkClass("javax.sql.DataSource")) + System.out.println("enterprise"); + else + System.out.println("jdbc2"); + //System.exit(0); + } + System.setProperty("postgresql.jdbc", "yoyo"); } - System.setProperty("postgresql.jdbc","yoyo"); - } } |