public class DataType extends Object
Modifier and Type | Field and Description |
---|---|
boolean |
autoIncrement
If this is an autoincrement type.
|
boolean |
caseSensitive
If this data type is an autoincrement type.
|
boolean |
decimal
If this is a numeric type.
|
int |
defaultDisplaySize
The default display size.
|
long |
defaultPrecision
The default precision.
|
int |
defaultScale
The default scale.
|
boolean |
hidden
If this data type should not be listed in the database meta data.
|
String |
jdbc
The Java class name.
|
long |
maxPrecision
The maximum supported precision.
|
int |
maxScale
The highest possible scale.
|
int |
memory
The number of bytes required for an object.
|
int |
minScale
The lowest possible scale.
|
String |
name
The data type name.
|
String |
params
The list of parameters used in the column definition.
|
String |
prefix
The prefix required for the SQL literal representation.
|
int |
sqlType
The SQL type.
|
int |
sqlTypePos
How closely the data type maps to the corresponding JDBC SQL type (low is
best).
|
String |
suffix
The suffix required for the SQL literal representation.
|
boolean |
supportsPrecision
If the precision parameter is supported.
|
boolean |
supportsScale
If the scale parameter is supported.
|
int |
type
The value type of this data type.
|
static int |
TYPE_LONGNVARCHAR
This constant is used for JDK 1.5 compatibility
and equal to java.sql.Types.LONGNVARCHAR
|
static int |
TYPE_NCHAR
This constant is used for JDK 1.5 compatibility
and equal to java.sql.Types.NCHAR
|
static int |
TYPE_NCLOB
This constant is used for JDK 1.5 compatibility
and equal to java.sql.Types.NCLOB
|
static int |
TYPE_NVARCHAR
This constant is used for JDK 1.5 compatibility
and equal to java.sql.Types.NVARCHAR
|
static int |
TYPE_RESULT_SET
This constant is used to represent the type of a ResultSet.
|
Constructor and Description |
---|
DataType() |
Modifier and Type | Method and Description |
---|---|
static int |
convertSQLTypeToValueType(int sqlType)
Convert a SQL type to a value type.
|
static Object |
convertTo(SessionInterface session,
JdbcConnection conn,
Value v,
Class<?> paramClass)
Convert a value to the specified class.
|
static Value |
convertToValue(SessionInterface session,
Object x,
int type)
Convert a Java object to a value.
|
static int |
convertTypeToSQLType(int type)
Convert a value type to a SQL type.
|
static int |
getAddProofType(int type)
Get the data type that will not overflow when calling 'add' 2 billion times.
|
static DataType |
getDataType(int type)
Get the data type object for the given value type.
|
static Object |
getDefaultForPrimitiveType(Class<?> clazz)
Get the default value in the form of a Java object for the given Java class.
|
static DataType |
getTypeByName(String s)
Get a data type object from a type name.
|
static String |
getTypeClassName(int type)
Get the name of the Java class for the given value type.
|
static int |
getTypeFromClass(Class<?> x)
Get the value type for the given Java class.
|
static ArrayList<DataType> |
getTypes()
Get the list of data types.
|
static boolean |
isLargeObject(int type)
Check if the given value type is a large object (BLOB or CLOB).
|
static boolean |
isStringType(int type)
Check if the given value type is a String (VARCHAR,...).
|
static Value |
readValue(SessionInterface session,
ResultSet rs,
int columnIndex,
int type)
Read a value from the given result set.
|
static boolean |
supportsAdd(int type)
Check if the given value type supports the add operation.
|
public static final int TYPE_RESULT_SET
public static final int TYPE_LONGNVARCHAR
public static final int TYPE_NCHAR
public static final int TYPE_NVARCHAR
public static final int TYPE_NCLOB
public int type
public String name
public int sqlType
public String jdbc
public int sqlTypePos
public long maxPrecision
public int minScale
public int maxScale
public boolean decimal
public String prefix
public String suffix
public String params
public boolean autoIncrement
public boolean caseSensitive
public boolean supportsPrecision
public boolean supportsScale
public long defaultPrecision
public int defaultScale
public int defaultDisplaySize
public boolean hidden
public int memory
public static Value readValue(SessionInterface session, ResultSet rs, int columnIndex, int type)
session
- the sessionrs
- the result setcolumnIndex
- the column index (1 based)type
- the data typepublic static String getTypeClassName(int type)
type
- the value typepublic static DataType getDataType(int type)
type
- the value typepublic static int convertTypeToSQLType(int type)
type
- the value typepublic static int convertSQLTypeToValueType(int sqlType)
sqlType
- the SQL typepublic static int getTypeFromClass(Class<?> x)
x
- the Java classpublic static Value convertToValue(SessionInterface session, Object x, int type)
session
- the sessionx
- the valuetype
- the value typepublic static DataType getTypeByName(String s)
s
- the type namepublic static boolean isLargeObject(int type)
type
- the value typepublic static boolean isStringType(int type)
type
- the value typepublic static boolean supportsAdd(int type)
type
- the value typepublic static int getAddProofType(int type)
type
- the value typepublic static Object getDefaultForPrimitiveType(Class<?> clazz)
clazz
- the Java classpublic static Object convertTo(SessionInterface session, JdbcConnection conn, Value v, Class<?> paramClass)
session
- the sessionconn
- the database connectionv
- the valueparamClass
- the target classCopyright © 2012 JBoss by Red Hat. All Rights Reserved.