1 30 31 32 package org.hsqldb.util; 33 34 import java.util.Hashtable ; 35 36 42 class JDBCTypes { 43 44 public static final int JAVA_OBJECT = 2000; 45 public static final int DISTINCT = 2001; 46 public static final int STRUCT = 2002; 47 public static final int ARRAY = 2003; 48 public static final int BLOB = 2004; 49 public static final int CLOB = 2005; 50 public static final int REF = 2006; 51 private Hashtable hStringJDBCtypes; 52 private Hashtable hIntJDBCtypes; 53 54 JDBCTypes() { 55 56 hStringJDBCtypes = new Hashtable (); 57 hIntJDBCtypes = new Hashtable (); 58 59 hStringJDBCtypes.put(new Integer (ARRAY), "ARRAY"); 60 hStringJDBCtypes.put(new Integer (BLOB), "BLOB"); 61 hStringJDBCtypes.put(new Integer (CLOB), "CLOB"); 62 hStringJDBCtypes.put(new Integer (DISTINCT), "DISTINCT"); 63 hStringJDBCtypes.put(new Integer (JAVA_OBJECT), "JAVA_OBJECT"); 64 hStringJDBCtypes.put(new Integer (REF), "REF"); 65 hStringJDBCtypes.put(new Integer (STRUCT), "STRUCT"); 66 67 hStringJDBCtypes.put(new Integer (java.sql.Types.BIGINT), "BIGINT"); 69 hStringJDBCtypes.put(new Integer (java.sql.Types.BINARY), "BINARY"); 70 hStringJDBCtypes.put(new Integer (java.sql.Types.BIT), "BIT"); 71 hStringJDBCtypes.put(new Integer (java.sql.Types.CHAR), "CHAR"); 72 hStringJDBCtypes.put(new Integer (java.sql.Types.DATE), "DATE"); 73 hStringJDBCtypes.put(new Integer (java.sql.Types.DECIMAL), "DECIMAL"); 74 hStringJDBCtypes.put(new Integer (java.sql.Types.DOUBLE), "DOUBLE"); 75 hStringJDBCtypes.put(new Integer (java.sql.Types.FLOAT), "FLOAT"); 76 hStringJDBCtypes.put(new Integer (java.sql.Types.INTEGER), "INTEGER"); 77 hStringJDBCtypes.put(new Integer (java.sql.Types.LONGVARBINARY), 78 "LONGVARBINARY"); 79 hStringJDBCtypes.put(new Integer (java.sql.Types.LONGVARCHAR), 80 "LONGVARCHAR"); 81 hStringJDBCtypes.put(new Integer (java.sql.Types.NULL), "NULL"); 82 hStringJDBCtypes.put(new Integer (java.sql.Types.NUMERIC), "NUMERIC"); 83 hStringJDBCtypes.put(new Integer (java.sql.Types.OTHER), "OTHER"); 84 hStringJDBCtypes.put(new Integer (java.sql.Types.REAL), "REAL"); 85 hStringJDBCtypes.put(new Integer (java.sql.Types.SMALLINT), 86 "SMALLINT"); 87 hStringJDBCtypes.put(new Integer (java.sql.Types.TIME), "TIME"); 88 hStringJDBCtypes.put(new Integer (java.sql.Types.TIMESTAMP), 89 "TIMESTAMP"); 90 hStringJDBCtypes.put(new Integer (java.sql.Types.TINYINT), "TINYINT"); 91 hStringJDBCtypes.put(new Integer (java.sql.Types.VARBINARY), 92 "VARBINARY"); 93 hStringJDBCtypes.put(new Integer (java.sql.Types.VARCHAR), "VARCHAR"); 94 95 hIntJDBCtypes.put("ARRAY", new Integer (ARRAY)); 97 hIntJDBCtypes.put("BLOB", new Integer (BLOB)); 98 hIntJDBCtypes.put("CLOB", new Integer (CLOB)); 99 hIntJDBCtypes.put("DISTINCT", new Integer (DISTINCT)); 100 hIntJDBCtypes.put("JAVA_OBJECT", new Integer (JAVA_OBJECT)); 101 hIntJDBCtypes.put("REF", new Integer (REF)); 102 hIntJDBCtypes.put("STRUCT", new Integer (STRUCT)); 103 104 hIntJDBCtypes.put("BIGINT", new Integer (java.sql.Types.BIGINT)); 106 hIntJDBCtypes.put("BINARY", new Integer (java.sql.Types.BINARY)); 107 hIntJDBCtypes.put("BIT", new Integer (java.sql.Types.BIT)); 108 hIntJDBCtypes.put("CHAR", new Integer (java.sql.Types.CHAR)); 109 hIntJDBCtypes.put("DATE", new Integer (java.sql.Types.DATE)); 110 hIntJDBCtypes.put("DECIMAL", new Integer (java.sql.Types.DECIMAL)); 111 hIntJDBCtypes.put("DOUBLE", new Integer (java.sql.Types.DOUBLE)); 112 hIntJDBCtypes.put("FLOAT", new Integer (java.sql.Types.FLOAT)); 113 hIntJDBCtypes.put("INTEGER", new Integer (java.sql.Types.INTEGER)); 114 hIntJDBCtypes.put("LONGVARBINARY", 115 new Integer (java.sql.Types.LONGVARBINARY)); 116 hIntJDBCtypes.put("LONGVARCHAR", 117 new Integer (java.sql.Types.LONGVARCHAR)); 118 hIntJDBCtypes.put("NULL", new Integer (java.sql.Types.NULL)); 119 hIntJDBCtypes.put("NUMERIC", new Integer (java.sql.Types.NUMERIC)); 120 hIntJDBCtypes.put("OTHER", new Integer (java.sql.Types.OTHER)); 121 hIntJDBCtypes.put("REAL", new Integer (java.sql.Types.REAL)); 122 hIntJDBCtypes.put("SMALLINT", new Integer (java.sql.Types.SMALLINT)); 123 hIntJDBCtypes.put("TIME", new Integer (java.sql.Types.TIME)); 124 hIntJDBCtypes.put("TIMESTAMP", new Integer (java.sql.Types.TIMESTAMP)); 125 hIntJDBCtypes.put("TINYINT", new Integer (java.sql.Types.TINYINT)); 126 hIntJDBCtypes.put("VARBINARY", new Integer (java.sql.Types.VARBINARY)); 127 hIntJDBCtypes.put("VARCHAR", new Integer (java.sql.Types.VARCHAR)); 128 } 129 130 public Hashtable getHashtable() { 131 return hStringJDBCtypes; 132 } 133 134 public String toString(int type) { 135 return (String ) hStringJDBCtypes.get(new Integer (type)); 136 } 137 138 public int toInt(String type) throws Exception { 139 140 Integer tempInteger = (Integer ) hIntJDBCtypes.get(type); 141 142 return tempInteger.intValue(); 143 } 144 } 145 | Popular Tags |