|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.akiban.sql.types.DataTypeDescriptor
public final class DataTypeDescriptor
DataTypeDescriptor describes a runtime SQL type. It consists of a catalog type (TypeDescriptor) and runtime attributes. The list of runtime attributes is:
A DataTypeDescriptor is immutable.
| Field Summary | |
|---|---|
static DataTypeDescriptor |
INTEGER
Runtime INTEGER type that is nullable. |
static DataTypeDescriptor |
INTEGER_NOT_NULL
Runtime INTEGER type that is not nullable. |
static int |
MAXIMUM_WIDTH_UNKNOWN
|
static DataTypeDescriptor |
MEDIUMINT
|
static DataTypeDescriptor |
MEDIUMINT_NOT_NULL
|
static DataTypeDescriptor |
SMALLINT
Runtime SMALLINT type that is nullable. |
static DataTypeDescriptor |
SMALLINT_NOT_NULL
Runtime INTEGER type that is not nullable. |
| Constructor Summary | |
|---|---|
DataTypeDescriptor(DataTypeDescriptor source,
CharacterTypeAttributes characterAttributes)
|
|
DataTypeDescriptor(TypeId typeId,
boolean isNullable)
|
|
DataTypeDescriptor(TypeId typeId,
boolean isNullable,
int maximumWidth)
Constructor for use with non-numeric types |
|
DataTypeDescriptor(TypeId typeId,
boolean isNullable,
int maximumWidth,
CharacterTypeAttributes characterAttributes)
|
|
DataTypeDescriptor(TypeId typeId,
int precision,
int scale,
boolean isNullable,
int maximumWidth)
Constructor for use with numeric types |
|
| Method Summary | |
|---|---|
boolean |
comparable(DataTypeDescriptor compareWithDTD,
boolean forEquals)
Check if this type is comparable with the passed type. |
static int |
computeMaxWidth(int precision,
int scale)
Compute the maximum width (column display width) of a decimal or numeric data value, given its precision and scale. |
boolean |
equals(Object other)
Compare if two DataTypeDescriptors are exactly the same |
static DataTypeDescriptor |
getBuiltInDataTypeDescriptor(int jdbcType)
Get a descriptor that corresponds to a nullable builtin JDBC type. |
static DataTypeDescriptor |
getBuiltInDataTypeDescriptor(int jdbcType,
boolean isNullable)
Get a descriptor that corresponds to a builtin JDBC type. |
static DataTypeDescriptor |
getBuiltInDataTypeDescriptor(int jdbcType,
boolean isNullable,
int maxLength)
Get a descriptor that corresponds to a builtin JDBC type. |
static DataTypeDescriptor |
getBuiltInDataTypeDescriptor(int jdbcType,
int length)
Get a descriptor that corresponds to a nullable builtin variable length JDBC type. |
static DataTypeDescriptor |
getBuiltInDataTypeDescriptor(String sqlTypeName)
Get a DataTypeDescriptor that corresponds to a nullable builtin SQL type. |
static DataTypeDescriptor |
getBuiltInDataTypeDescriptor(String sqlTypeName,
int length)
Get a DataTypeDescriptor that corresponds to a builtin SQL type Collation type will be UCS_BASIC and derivation IMPLICIT. |
CharacterTypeAttributes |
getCharacterAttributes()
|
DataTypeDescriptor |
getDominantType(DataTypeDescriptor otherDTS)
Get the dominant type (DataTypeDescriptor) of the 2. |
String |
getFullSQLTypeName()
Return the SQL type name and, if applicable, scale/precision/length for this DataTypeDescriptor. |
int |
getJDBCTypeId()
Get the jdbc type id for this type. |
int |
getMaximumWidth()
Get maximum width. |
DataTypeDescriptor |
getNullabilityType(boolean isNullable)
Return a type descriptor identical to the this type with the exception of its nullability. |
int |
getPrecision()
Returns the number of decimal digits for the datatype, if applicable. |
static DataTypeDescriptor |
getRowMultiSet(String[] columnNames,
DataTypeDescriptor[] columnTypes)
Get a catalog type that corresponds to a SQL Row Multiset |
int |
getScale()
Returns the number of digits to the right of the decimal for the datatype, if applicable. |
static DataTypeDescriptor |
getSQLDataTypeDescriptor(String javaTypeName)
Get a DataTypeDescriptor that corresponds to a Java type |
static DataTypeDescriptor |
getSQLDataTypeDescriptor(String javaTypeName,
boolean isNullable)
Get a DataTypeDescriptor that corresponds to a Java type |
static DataTypeDescriptor |
getSQLDataTypeDescriptor(String javaTypeName,
int precision,
int scale,
boolean isNullable,
int maximumWidth)
Get a DataTypeDescriptor that corresponds to a Java type |
String |
getSQLstring()
Converts this data type descriptor (including length/precision) to a string. |
TypeId |
getTypeId()
Gets the TypeId for the datatype. |
String |
getTypeName()
Gets the name of this datatype. |
DataTypeDescriptor |
getUnsigned()
|
static int |
intervalMaxWidth(TypeId typeId,
int precision,
int scale)
|
static boolean |
isAsciiStreamAssignable(int jdbcType)
Determine if an ASCII stream can be inserted into a column or parameter of type jdbcType. |
static boolean |
isBinaryStreamAssignable(int jdbcType)
Determine if a binary stream can be inserted into a column or parameter of type jdbcType. |
static boolean |
isCharacterStreamAssignable(int jdbcType)
Determine if a character stream can be inserted into a column or parameter of type jdbcType. |
static boolean |
isJDBCTypeEquivalent(int existingType,
int jdbcTypeId)
Compare JdbcTypeIds to determine if they represent equivalent SQL types. |
boolean |
isNullable()
Returns TRUE if the datatype can contain NULL, FALSE if not. |
static boolean |
isNumericType(int jdbcType)
|
boolean |
isRowMultiSet()
|
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int MAXIMUM_WIDTH_UNKNOWN
public static final DataTypeDescriptor MEDIUMINT
public static final DataTypeDescriptor MEDIUMINT_NOT_NULL
public static final DataTypeDescriptor INTEGER
public static final DataTypeDescriptor INTEGER_NOT_NULL
public static final DataTypeDescriptor SMALLINT
public static final DataTypeDescriptor SMALLINT_NOT_NULL
| Constructor Detail |
|---|
public DataTypeDescriptor(TypeId typeId,
int precision,
int scale,
boolean isNullable,
int maximumWidth)
typeId - The typeId of the type being describedprecision - The number of decimal digits.scale - The number of digits after the decimal point.isNullable - TRUE means it could contain NULL, FALSE means
it definitely cannot contain NULL.maximumWidth - The maximum number of bytes for this datatype
public DataTypeDescriptor(TypeId typeId,
boolean isNullable,
int maximumWidth)
typeId - The typeId of the type being describedisNullable - TRUE means it could contain NULL, FALSE means
it definitely cannot contain NULL.maximumWidth - The maximum number of bytes for this datatype
public DataTypeDescriptor(TypeId typeId,
boolean isNullable)
public DataTypeDescriptor(TypeId typeId,
boolean isNullable,
int maximumWidth,
CharacterTypeAttributes characterAttributes)
public DataTypeDescriptor(DataTypeDescriptor source,
CharacterTypeAttributes characterAttributes)
| Method Detail |
|---|
public static DataTypeDescriptor getBuiltInDataTypeDescriptor(int jdbcType)
jdbcType - The int type of the JDBC type for which to get
a corresponding SQL DataTypeDescriptor
public static DataTypeDescriptor getBuiltInDataTypeDescriptor(int jdbcType,
int length)
jdbcType - The int type of the JDBC type for which to get
a corresponding SQL DataTypeDescriptor
public static DataTypeDescriptor getBuiltInDataTypeDescriptor(int jdbcType,
boolean isNullable)
jdbcType - The int type of the JDBC type for which to get
a corresponding SQL DataTypeDescriptorisNullable - TRUE means it could contain NULL, FALSE means
it definitely cannot contain NULL.
public static DataTypeDescriptor getBuiltInDataTypeDescriptor(int jdbcType,
boolean isNullable,
int maxLength)
jdbcType - The int type of the JDBC type for which to get
a corresponding SQL DataTypeDescriptorisNullable - TRUE means it could contain NULL, FALSE means
it definitely cannot contain NULL.
public static DataTypeDescriptor getBuiltInDataTypeDescriptor(String sqlTypeName)
sqlTypeName - The name of the type for which to get
a corresponding SQL DataTypeDescriptor
public static DataTypeDescriptor getBuiltInDataTypeDescriptor(String sqlTypeName,
int length)
sqlTypeName - The name of the type for which to get
a corresponding SQL DataTypeDescriptor
public static DataTypeDescriptor getSQLDataTypeDescriptor(String javaTypeName)
throws StandardException
javaTypeName - The name of the Java type for which to get
a corresponding SQL DataTypeDescriptor
StandardException
public static DataTypeDescriptor getSQLDataTypeDescriptor(String javaTypeName,
boolean isNullable)
throws StandardException
javaTypeName - The name of the Java type for which to get
a corresponding SQL DataTypeDescriptorisNullable - TRUE means it could contain NULL, FALSE means
it definitely cannot contain NULL.
StandardException
public static DataTypeDescriptor getSQLDataTypeDescriptor(String javaTypeName,
int precision,
int scale,
boolean isNullable,
int maximumWidth)
throws StandardException
javaTypeName - The name of the Java type for which to get
a corresponding SQL DataTypeDescriptorprecision - The number of decimal digitsscale - The number of digits after the decimal pointisNullable - TRUE means it could contain NULL, FALSE means
it definitely cannot contain NULL.maximumWidth - The maximum width of a data value
represented by this type.
StandardException
public static DataTypeDescriptor getRowMultiSet(String[] columnNames,
DataTypeDescriptor[] columnTypes)
columnNames - Names of the columns in the Row MulisetcatalogTypes - Types of the columns in the Row Muliset
public DataTypeDescriptor getDominantType(DataTypeDescriptor otherDTS)
throws StandardException
otherDTS - DataTypeDescriptor to compare with.
StandardException - Thrown on errorpublic int getMaximumWidth()
public TypeId getTypeId()
public String getTypeName()
public int getJDBCTypeId()
Typespublic int getPrecision()
TypeDescriptor#getPrecision()public int getScale()
TypeDescriptor#getScale()public boolean isNullable()
public boolean isRowMultiSet()
public DataTypeDescriptor getNullabilityType(boolean isNullable)
isNullable - True to return a nullable type, false otherwise.public CharacterTypeAttributes getCharacterAttributes()
public boolean equals(Object other)
equals in class Objectother - the type to compare to.
public boolean comparable(DataTypeDescriptor compareWithDTD,
boolean forEquals)
compareWithDTD - the type of the instance to compare with this type.forEquals - True if this is an = or <> comparison, false
otherwise.
public String getSQLstring()
public static boolean isJDBCTypeEquivalent(int existingType,
int jdbcTypeId)
existingType - JDBC type id of Derby data typejdbcTypeId - JDBC type id passed in from application.
public static boolean isNumericType(int jdbcType)
public static boolean isAsciiStreamAssignable(int jdbcType)
jdbcType.
jdbcType - JDBC type of column or parameter
true if an ASCII stream can be inserted;
false otherwisepublic static boolean isBinaryStreamAssignable(int jdbcType)
jdbcType.
jdbcType - JDBC type of column or parameter
true if a binary stream can be inserted;
false otherwisepublic static boolean isCharacterStreamAssignable(int jdbcType)
jdbcType.
jdbcType - JDBC type of column or parameter
true if a character stream can be inserted;
false otherwisepublic String toString()
toString in class Objectpublic String getFullSQLTypeName()
public static int computeMaxWidth(int precision,
int scale)
precision - The precision (number of digits) of the data value.scale - The number of fractional digits (digits to the right of the decimal point).
public DataTypeDescriptor getUnsigned()
throws StandardException
StandardException
public static int intervalMaxWidth(TypeId typeId,
int precision,
int scale)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||