1 /* Created on Jan 9, 2004 */
2 package com.quantum.util.sql;
4 import java.lang.reflect.Field;
10 public class TypesHelper {
12 public static final int BIT = Types.BIT;
13 public static final int TINYINT = Types.TINYINT;
14 public static final int SMALLINT = Types.SMALLINT;
15 public static final int INTEGER = Types.INTEGER;
16 public static final int BIGINT = Types.BIGINT;
17 public static final int FLOAT = Types.FLOAT;
18 public static final int REAL = Types.REAL;
19 public static final int DOUBLE = Types.DOUBLE;
20 public static final int NUMERIC = Types.NUMERIC;
21 public static final int DECIMAL = Types.DECIMAL;
22 public static final int CHAR = Types.CHAR;
23 public static final int VARCHAR = Types.VARCHAR;
24 public static final int LONGVARCHAR = Types.LONGVARCHAR;
25 public static final int DATE = Types.DATE;
26 public static final int TIME = Types.TIME;
27 public static final int TIMESTAMP = Types.TIMESTAMP;
28 public static final int BINARY = Types.BINARY;
29 public static final int VARBINARY = Types.VARBINARY;
30 public static final int LONGVARBINARY = Types.LONGVARBINARY;
31 public static final int NULL = Types.NULL;
32 public static final int OTHER = Types.OTHER;
33 public static final int JAVA_OBJECT = Types.JAVA_OBJECT;
34 public static final int DISTINCT = Types.DISTINCT;
35 public static final int STRUCT = Types.STRUCT;
36 public static final int ARRAY = Types.ARRAY;
37 public static final int BLOB = Types.BLOB;
38 public static final int CLOB = Types.CLOB;
39 public static final int REF = Types.REF;
40 public static final int DATALINK;
41 public static final int BOOLEAN;
44 // These fields only exist in the JDK 1.4 version of the Types class.
45 BOOLEAN = getType("BOOLEAN", 16);
46 DATALINK = getType("DATALINK", 70);
49 private static int getType(String typeName, int defaultValue) {
51 Field field = Types.class.getField(typeName);
52 defaultValue = field.getInt(null);
53 } catch (NoSuchFieldException e) {
54 } catch (IllegalAccessException e) {