DataType

This class contains meta data information about data types, and can convert between Java objects and Values.

Methods
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 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.
Parameters:
sqlType - the SQL type
sqlTypeName - the SQL type name
Returns:
the value type
static int convertSQLTypeToValueType(int sqlType)
Convert a SQL type to a value type.
static int convertSQLTypeToValueType(int sqlType)
Convert a SQL type to a value type.
Parameters:
sqlType - the SQL type
Returns:
the value type
static Object convertTo(JdbcConnection conn, Value v, Class paramClass)
Convert a value to the specified class.
static Object convertTo(JdbcConnection conn, Value v, Class paramClass)
Convert a value to the specified class.
Parameters:
conn - the database connection
v - the value
paramClass - the target class
Returns:
the converted object
static Value convertToValue(SessionInterface session, Object x, int type)
Convert a Java object to a value.
static Value convertToValue(SessionInterface session, Object x, int type)
Convert a Java object to a value.
Parameters:
session - the session
x - the value
type - the value type
Returns:
the value
static int convertTypeToSQLType(int type)
Convert a value type to a SQL type.
static int convertTypeToSQLType(int type)
Convert a value type to a SQL type.
Parameters:
type - the value type
Returns:
the SQL type
static int getAddProofType(int type)
Get the data type that will not overflow when calling 'add' 2 billion times.
static int getAddProofType(int type)
Get the data type that will not overflow when calling 'add' 2 billion times.
Parameters:
type - the value type
Returns:
the data type that supports adding
static DataType getDataType(int type)
Get the data type object for the given value type.
static DataType getDataType(int type)
Get the data type object for the given value type.
Parameters:
type - the value type
Returns:
the data type object
static Object getDefaultForPrimitiveType(Class clazz)
Get the default value in the form of a Java object for the given Java class.
static Object getDefaultForPrimitiveType(Class clazz)
Get the default value in the form of a Java object for the given Java class.
Parameters:
clazz - the Java class
Returns:
the default object
static DataType getTypeByName(String s, Mode mode)
Get a data type object from a type name.
static DataType getTypeByName(String s, Mode mode)
Get a data type object from a type name.
Parameters:
s - the type name
mode - database mode
Returns:
the data type object
static String getTypeClassName(int type)
Get the name of the Java class for the given value type.
static String getTypeClassName(int type)
Get the name of the Java class for the given value type.
Parameters:
type - the value type
Returns:
the class name
static int getTypeFromClass(Class x)
Get the value type for the given Java class.
static int getTypeFromClass(Class x)
Get the value type for the given Java class.
Parameters:
x - the Java class
Returns:
the value type
static ArrayList getTypes()
Get the list of data types.
static ArrayList getTypes()
Get the list of data types.
Returns:
the list
static int getValueTypeFromResultSet(ResultSetMetaData meta, int columnIndex)
Get the SQL type from the result set meta data for the given column.
static int getValueTypeFromResultSet(ResultSetMetaData meta, int columnIndex) throws SQLException
Get the SQL type from the result set meta data for the given column. This method uses the SQL type and type name.
Parameters:
meta - the meta data
columnIndex - the column index (1, 2,...)
Returns:
the value type
static boolean isGeometry(Object x)
Check whether a given object is a Geometry object.
static boolean isGeometry(Object x)
Check whether a given object is a Geometry object.
Parameters:
x - the the object
Returns:
true if it is a Geometry object
static boolean isGeometryClass(Class x)
Check whether a given class matches the Geometry class.
static boolean isGeometryClass(Class x)
Check whether a given class matches the Geometry class.
Parameters:
x - the class
Returns:
true if it is a Geometry class
static boolean isLargeObject(int type)
Check if the given value type is a large object (BLOB or CLOB).
static boolean isLargeObject(int type)
Check if the given value type is a large object (BLOB or CLOB).
Parameters:
type - the value type
Returns:
true if the value type is a lob type
static boolean isStringType(int type)
Check if the given value type is a String (VARCHAR,...).
static boolean isStringType(int type)
Check if the given value type is a String (VARCHAR,...).
Parameters:
type - the value type
Returns:
true if the value type is a String type
static Value readValue(SessionInterface session, ResultSet rs, int columnIndex, int type)
Read a value from the given result set.
static Value readValue(SessionInterface session, ResultSet rs, int columnIndex, int type)
Read a value from the given result set.
Parameters:
session - the session
rs - the result set
columnIndex - the column index (1 based)
type - the data type
Returns:
the value
static boolean supportsAdd(int type)
Check if the given value type supports the add operation.
static boolean supportsAdd(int type)
Check if the given value type supports the add operation.
Parameters:
type - the value type
Returns:
true if add is supported

Fields
static Class GEOMETRY_CLASS
static int TYPE_RESULT_SET = -10
static boolean autoIncrement
static boolean caseSensitive
static boolean decimal
static int defaultDisplaySize
static long defaultPrecision
static int defaultScale
static boolean hidden
static long maxPrecision
static int maxScale
static int memory
static int minScale
static String name
static String params
static String prefix
static int sqlType
static int sqlTypePos
static String suffix
static boolean supportsPrecision
static boolean supportsScale
static int type

TYPE_RESULT_SET = -10

This constant is used to represent the type of a ResultSet. There is no equivalent java.sql.Types value, but Oracle uses it to represent a ResultSet (OracleTypes.CURSOR = -10).

GEOMETRY_CLASS

The Geometry class. This object is null if the jts jar file is not in the classpath.

autoIncrement

If this is an autoincrement type.

caseSensitive

If this data type is an autoincrement type.

decimal

If this is a numeric type.

defaultDisplaySize

The default display size.

defaultPrecision

The default precision.

defaultScale

The default scale.

hidden

If this data type should not be listed in the database meta data.

maxPrecision

The maximum supported precision.

maxScale

The highest possible scale.

memory

The number of bytes required for an object.

minScale

The lowest possible scale.

name

The data type name.

params

The list of parameters used in the column definition.

prefix

The prefix required for the SQL literal representation.

sqlType

The SQL type.

sqlTypePos

How closely the data type maps to the corresponding JDBC SQL type (low is best).

suffix

The suffix required for the SQL literal representation.

supportsPrecision

If the precision parameter is supported.

supportsScale

If the scale parameter is supported.

type

The value type of this data type.