public class DataType
extends java.lang.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 java.lang.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.
|
java.lang.String |
name
The data type name.
|
java.lang.String |
params
The list of parameters used in the column definition.
|
java.lang.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).
|
java.lang.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,
java.lang.String sqlTypeName)
Convert a SQL type to a value type using SQL type name, in order to
manage SQL type extension mechanism.
|
static java.lang.Object |
convertTo(JdbcConnection conn,
Value v,
java.lang.Class<?> paramClass)
Convert a value to the specified class.
|
static Value |
convertToValue(SessionInterface session,
java.lang.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 java.lang.Object |
getDefaultForPrimitiveType(java.lang.Class<?> clazz)
Get the default value in the form of a Java object for the given Java
class.
|
static DataType |
getTypeByName(java.lang.String s,
Mode mode)
Get a data type object from a type name.
|
static java.lang.String |
getTypeClassName(int type)
Get the name of the Java class for the given value type.
|
static int |
getTypeFromClass(java.lang.Class<?> x)
Get the value type for the given Java class.
|
static java.util.ArrayList<DataType> |
getTypes()
Get the list of data types.
|
static int |
getValueTypeFromResultSet(java.sql.ResultSetMetaData meta,
int columnIndex)
Get the SQL type from the result set meta data for the given column.
|
static boolean |
isGeometry(java.lang.Object x)
Check whether a given object is a Geometry object.
|
static boolean |
isGeometryClass(java.lang.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,
java.sql.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 java.lang.Class<?> GEOMETRY_CLASS
public int type
public java.lang.String name
public int sqlType
public int sqlTypePos
public long maxPrecision
public int minScale
public int maxScale
public boolean decimal
public java.lang.String prefix
public java.lang.String suffix
public java.lang.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 java.util.ArrayList<DataType> getTypes()
public static Value readValue(SessionInterface session, java.sql.ResultSet rs, int columnIndex, int type)
session - the sessionrs - the result setcolumnIndex - the column index (1 based)type - the data typepublic static java.lang.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,
java.lang.String sqlTypeName)
sqlType - the SQL typesqlTypeName - the SQL type namepublic static int getValueTypeFromResultSet(java.sql.ResultSetMetaData meta,
int columnIndex)
throws java.sql.SQLException
meta - the meta datacolumnIndex - the column index (1, 2,...)java.sql.SQLExceptionpublic static int convertSQLTypeToValueType(int sqlType)
sqlType - the SQL typepublic static int getTypeFromClass(java.lang.Class<?> x)
x - the Java classpublic static Value convertToValue(SessionInterface session, java.lang.Object x, int type)
session - the sessionx - the valuetype - the value typepublic static boolean isGeometryClass(java.lang.Class<?> x)
x - the classpublic static boolean isGeometry(java.lang.Object x)
x - the the objectpublic static DataType getTypeByName(java.lang.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 java.lang.Object getDefaultForPrimitiveType(java.lang.Class<?> clazz)
clazz - the Java classpublic static java.lang.Object convertTo(JdbcConnection conn, Value v, java.lang.Class<?> paramClass)
conn - the database connectionv - the valueparamClass - the target class