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.
|
static Class<?> |
GEOMETRY_CLASS
The Geometry class.
|
boolean |
hidden
If this data type should not be listed in the database meta data.
|
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_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 int |
convertSQLTypeToValueType(int sqlType,
String sqlTypeName)
Convert a SQL type to a value type using SQL type name, in order to
manage SQL type extension mechanism.
|
static Object |
convertTo(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,
Mode mode)
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 int |
getValueTypeFromResultSet(ResultSetMetaData meta,
int columnIndex)
Get the SQL type from the result set meta data for the given column.
|
static boolean |
isGeometry(Object x)
Check whether a given object is a Geometry object.
|
static boolean |
isGeometryClass(Class<?> x)
Check whether a given class matches the Geometry class.
|
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 Class<?> GEOMETRY_CLASS
public int type
public String name
public int sqlType
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, String sqlTypeName)
sqlType
- the SQL typesqlTypeName
- the SQL type namepublic static int getValueTypeFromResultSet(ResultSetMetaData meta, int columnIndex) throws SQLException
meta
- the meta datacolumnIndex
- the column index (1, 2,...)SQLException
public 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 boolean isGeometryClass(Class<?> x)
x
- the classpublic static boolean isGeometry(Object x)
x
- the the objectpublic static DataType getTypeByName(String s, Mode mode)
s
- the type namemode
- database modepublic 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(JdbcConnection conn, Value v, Class<?> paramClass)
conn
- the database connectionv
- the valueparamClass
- the target classCopyright © 2020 JBoss by Red Hat. All rights reserved.