/* Created on Jan 9, 2004 */ package com.quantum.util.sql; import java.lang.reflect.Field; import java.sql.Types; /** * @author holmesbc */ public class TypesHelper { public static final int BIT = Types.BIT; public static final int TINYINT = Types.TINYINT; public static final int SMALLINT = Types.SMALLINT; public static final int INTEGER = Types.INTEGER; public static final int BIGINT = Types.BIGINT; public static final int FLOAT = Types.FLOAT; public static final int REAL = Types.REAL; public static final int DOUBLE = Types.DOUBLE; public static final int NUMERIC = Types.NUMERIC; public static final int DECIMAL = Types.DECIMAL; public static final int CHAR = Types.CHAR; public static final int VARCHAR = Types.VARCHAR; public static final int LONGVARCHAR = Types.LONGVARCHAR; public static final int DATE = Types.DATE; public static final int TIME = Types.TIME; public static final int TIMESTAMP = Types.TIMESTAMP; public static final int BINARY = Types.BINARY; public static final int VARBINARY = Types.VARBINARY; public static final int LONGVARBINARY = Types.LONGVARBINARY; public static final int NULL = Types.NULL; public static final int OTHER = Types.OTHER; public static final int JAVA_OBJECT = Types.JAVA_OBJECT; public static final int DISTINCT = Types.DISTINCT; public static final int STRUCT = Types.STRUCT; public static final int ARRAY = Types.ARRAY; public static final int BLOB = Types.BLOB; public static final int CLOB = Types.CLOB; public static final int REF = Types.REF; public static final int DATALINK; public static final int BOOLEAN; static { // These fields only exist in the JDK 1.4 version of the Types class. BOOLEAN = getType("BOOLEAN", 16); DATALINK = getType("DATALINK", 70); } private static int getType(String typeName, int defaultValue) { try { Field field = Types.class.getField(typeName); defaultValue = field.getInt(null); } catch (NoSuchFieldException e) { } catch (IllegalAccessException e) { } return defaultValue; } }