| |
|
| java.lang.Object org.apache.derby.iapi.types.TypeId
TypeId | final public class TypeId implements Formatable(Code) | | The TypeId interface provides methods to get information about datatype ids.
The equals(Object) method can be used to determine if two typeIds are for the same type,
which defines type id equality.
author: Jeff Lichtman |
Method Summary | |
public boolean | equals(Object that) we want equals to say if these are the same type id or not. | public int | getApproximateLengthInBytes(DataTypeDescriptor dts) Get the approximate length of this type in bytes.
For most datatypes this is just going to be
dts.getMaximumWidth(). | public BaseTypeIdImpl | getBaseTypeId() Get the base type id that is embedded in this type id. | public static TypeId | getBuiltInTypeId(int JDBCTypeId) Get a TypeId of the given JDBC type. | public static TypeId | getBuiltInTypeId(String SQLTypeName) | public boolean | getClassNameWasDelimitedIdentifier() For user types, tell whether or not the class name was a
delimited identifier. | public String | getCorrespondingJavaTypeName() Get the name of the corresponding Java type.
Each SQL type has a corresponding Java type. | final public int | getJDBCTypeId() JDBC has its own idea of type identifiers which is different from
the Cloudscape internal type ids. | public int | getMaximumMaximumWidth() Get the maximum maximum width of the type (that's not a typo). | public int | getMaximumPrecision() Get the maximum precision of the type. | public int | getMaximumScale() Get the maximum scale of the type. | public DataValueDescriptor | getNull() Get SQL null value. | public int | getPrecision(DataTypeDescriptor leftType, DataTypeDescriptor rightType) | public String | getResultSetMetaDataTypeName() Get the name of the corresponding Java type. | public static TypeId | getSQLTypeForJavaType(String javaTypeName) Get a TypeId for the class that corresponds to the given
Java type name. | public String | getSQLTypeName() Returns the SQL name of the datatype. | public int | getScale(DataTypeDescriptor leftType, DataTypeDescriptor rightType) | public int | getTypeFormatId() Get the formatID which corresponds to this class. | public static TypeId | getUserDefinedTypeId(String className, boolean delimitedIdentifier) | public int | hashCode() | public boolean | isBitTypeId() | public boolean | isBlobTypeId() | public boolean | isBooleanTypeId() | public boolean | isClobTypeId() | public boolean | isConcatableTypeId() | public boolean | isDateTimeTimeStampTypeID() | public boolean | isDateTimeTimeStampTypeId() | public boolean | isDecimalTypeId() | public boolean | isDoubleTypeId() | public boolean | isFixedStringTypeId() | public boolean | isFloatingPointTypeId() | public boolean | isLOBTypeId() | public boolean | isLongConcatableTypeId() | public boolean | isLongVarcharTypeId() | public boolean | isNationalStringTypeId() Does this type id represent a national character string. | public boolean | isNumericTypeId() | public boolean | isRealTypeId() | public boolean | isRefTypeId() | public boolean | isStringTypeId() Does this TypeId represent a TypeId for a StringDataType. | public boolean | isUserDefinedTypeId() | public boolean | isXMLTypeId() | public boolean | orderable(ClassFactory cf) Tell whether this type is orderable, that is, can participate
in comparisons. | public void | readExternal(ObjectInput in) Read this object from a stream of stored objects. | public void | setNestedTypeId(BaseTypeIdImpl typeId) Set the nested BaseTypeId in this TypeId. | public boolean | streamStorable() | public String | toParsableString(DataTypeDescriptor dts) Converts this TypeId, given a data type descriptor (including length/precision),
to a string. | public int | typePrecedence() Each built-in type in JSQL has a precedence. | final public boolean | userType() Tell whether this is a built-in type. | public boolean | variableLength() Does type hava a declared variable length (defined by the application).
Examples are CHAR(10), CLOB(1M).
Unbounded long types, like LONG VARCHAR return false here.
boolean true if type is variable length false if not. | public void | writeExternal(ObjectOutput out) Write this object to a stream of stored objects. |
BIT_MAXWIDTH | final public static int BIT_MAXWIDTH(Code) | | |
BIT_PRECEDENCE | final public static int BIT_PRECEDENCE(Code) | | |
BLOB_MAXWIDTH | final public static int BLOB_MAXWIDTH(Code) | | |
BLOB_PRECEDENCE | final public static int BLOB_PRECEDENCE(Code) | | |
BOOLEAN_MAXWIDTH | final public static int BOOLEAN_MAXWIDTH(Code) | | |
BOOLEAN_PRECEDENCE | final public static int BOOLEAN_PRECEDENCE(Code) | | |
CHAR_MAXWIDTH | final public static int CHAR_MAXWIDTH(Code) | | |
CHAR_PRECEDENCE | final public static int CHAR_PRECEDENCE(Code) | | |
CLOB_MAXWIDTH | final public static int CLOB_MAXWIDTH(Code) | | |
CLOB_PRECEDENCE | final public static int CLOB_PRECEDENCE(Code) | | |
DATE_MAXWIDTH | final public static int DATE_MAXWIDTH(Code) | | |
DATE_PRECEDENCE | final public static int DATE_PRECEDENCE(Code) | | |
DECIMAL_MAXWIDTH | final public static int DECIMAL_MAXWIDTH(Code) | | |
DECIMAL_PRECEDENCE | final public static int DECIMAL_PRECEDENCE(Code) | | |
DECIMAL_PRECISION | final public static int DECIMAL_PRECISION(Code) | | |
DECIMAL_SCALE | final public static int DECIMAL_SCALE(Code) | | |
DOUBLE_MAXWIDTH | final public static int DOUBLE_MAXWIDTH(Code) | | |
DOUBLE_PRECEDENCE | final public static int DOUBLE_PRECEDENCE(Code) | | |
DOUBLE_PRECISION | final public static int DOUBLE_PRECISION(Code) | | |
DOUBLE_PRECISION_IN_DIGITS | final public static int DOUBLE_PRECISION_IN_DIGITS(Code) | | |
DOUBLE_SCALE | final public static int DOUBLE_SCALE(Code) | | |
INT_MAXWIDTH | final public static int INT_MAXWIDTH(Code) | | |
INT_PRECEDENCE | final public static int INT_PRECEDENCE(Code) | | |
INT_PRECISION | final public static int INT_PRECISION(Code) | | |
INT_SCALE | final public static int INT_SCALE(Code) | | |
LONGINT_MAXWIDTH | final public static int LONGINT_MAXWIDTH(Code) | | |
LONGINT_PRECEDENCE | final public static int LONGINT_PRECEDENCE(Code) | | |
LONGINT_PRECISION | final public static int LONGINT_PRECISION(Code) | | Various fixed numbers related to datatypes.
|
LONGINT_SCALE | final public static int LONGINT_SCALE(Code) | | |
LONGVARBINARY_NAME | final public static String LONGVARBINARY_NAME(Code) | | |
LONGVARBIT_MAXWIDTH | final public static int LONGVARBIT_MAXWIDTH(Code) | | |
LONGVARBIT_NAME | final public static String LONGVARBIT_NAME(Code) | | |
LONGVARBIT_PRECEDENCE | final public static int LONGVARBIT_PRECEDENCE(Code) | | |
LONGVARCHAR_MAXWIDTH | final public static int LONGVARCHAR_MAXWIDTH(Code) | | |
LONGVARCHAR_NAME | final public static String LONGVARCHAR_NAME(Code) | | |
LONGVARCHAR_PRECEDENCE | final public static int LONGVARCHAR_PRECEDENCE(Code) | | |
NATIONAL_CHAR_MAXWIDTH | final public static int NATIONAL_CHAR_MAXWIDTH(Code) | | |
NATIONAL_CHAR_NAME | final public static String NATIONAL_CHAR_NAME(Code) | | |
NATIONAL_CHAR_PRECEDENCE | final public static int NATIONAL_CHAR_PRECEDENCE(Code) | | |
NATIONAL_LONGVARCHAR_MAXWIDTH | final public static int NATIONAL_LONGVARCHAR_MAXWIDTH(Code) | | |
NATIONAL_LONGVARCHAR_NAME | final public static String NATIONAL_LONGVARCHAR_NAME(Code) | | |
NATIONAL_LONGVARCHAR_PRECEDENCE | final public static int NATIONAL_LONGVARCHAR_PRECEDENCE(Code) | | |
NATIONAL_VARCHAR_MAXWIDTH | final public static int NATIONAL_VARCHAR_MAXWIDTH(Code) | | |
NATIONAL_VARCHAR_NAME | final public static String NATIONAL_VARCHAR_NAME(Code) | | |
NATIONAL_VARCHAR_PRECEDENCE | final public static int NATIONAL_VARCHAR_PRECEDENCE(Code) | | |
NCLOB_MAXWIDTH | final public static int NCLOB_MAXWIDTH(Code) | | |
NCLOB_PRECEDENCE | final public static int NCLOB_PRECEDENCE(Code) | | |
NUMERIC_PRECEDENCE | final public static int NUMERIC_PRECEDENCE(Code) | | |
REAL_MAXWIDTH | final public static int REAL_MAXWIDTH(Code) | | |
REAL_PRECEDENCE | final public static int REAL_PRECEDENCE(Code) | | |
REAL_PRECISION | final public static int REAL_PRECISION(Code) | | |
REAL_PRECISION_IN_DIGITS | final public static int REAL_PRECISION_IN_DIGITS(Code) | | |
REAL_SCALE | final public static int REAL_SCALE(Code) | | |
REF_PRECEDENCE | final public static int REF_PRECEDENCE(Code) | | |
SMALLINT_MAXWIDTH | final public static int SMALLINT_MAXWIDTH(Code) | | |
SMALLINT_PRECEDENCE | final public static int SMALLINT_PRECEDENCE(Code) | | |
SMALLINT_PRECISION | final public static int SMALLINT_PRECISION(Code) | | |
SMALLINT_SCALE | final public static int SMALLINT_SCALE(Code) | | |
TIMESTAMP_MAXWIDTH | final public static int TIMESTAMP_MAXWIDTH(Code) | | |
TIMESTAMP_NAME | final public static String TIMESTAMP_NAME(Code) | | |
TIMESTAMP_PRECEDENCE | final public static int TIMESTAMP_PRECEDENCE(Code) | | |
TIMESTAMP_SCALE | final public static int TIMESTAMP_SCALE(Code) | | |
TIME_MAXWIDTH | final public static int TIME_MAXWIDTH(Code) | | |
TIME_PRECEDENCE | final public static int TIME_PRECEDENCE(Code) | | |
TIME_SCALE | final public static int TIME_SCALE(Code) | | |
TINYINT_MAXWIDTH | final public static int TINYINT_MAXWIDTH(Code) | | |
TINYINT_PRECEDENCE | final public static int TINYINT_PRECEDENCE(Code) | | |
TINYINT_PRECISION | final public static int TINYINT_PRECISION(Code) | | |
TINYINT_SCALE | final public static int TINYINT_SCALE(Code) | | |
USER_PRECEDENCE | final public static int USER_PRECEDENCE(Code) | | The following constants define the type precedence hierarchy.
|
VARBINARY_NAME | final public static String VARBINARY_NAME(Code) | | |
VARBIT_MAXWIDTH | final public static int VARBIT_MAXWIDTH(Code) | | |
VARBIT_PRECEDENCE | final public static int VARBIT_PRECEDENCE(Code) | | |
VARCHAR_MAXWIDTH | final public static int VARCHAR_MAXWIDTH(Code) | | |
VARCHAR_PRECEDENCE | final public static int VARCHAR_PRECEDENCE(Code) | | |
XML_MAXWIDTH | final public static int XML_MAXWIDTH(Code) | | |
XML_PRECEDENCE | final public static int XML_PRECEDENCE(Code) | | |
decimalImplementation | static DataValueDescriptor decimalImplementation(Code) | | Implementation of DECIMAL datatype for generating holders through getNull.
Set by the booted DataValueFactory implementation.
|
TypeId | public TypeId(int formatId)(Code) | | 1 argmument constructor. Needed for Formatable interface to work.
Parameters: formatId - Format id of specific type id. |
TypeId | public TypeId(int formatId, BaseTypeIdImpl baseTypeId)(Code) | | Constructor for a TypeId
Parameters: formatId - Format id of specific type id. Parameters: baseTypeId - The Base type id |
TypeId | public TypeId(int formatId, BaseTypeIdImpl baseTypeId, boolean classNameWasDelimitedIdentifier)(Code) | | Constructor for a TypeId for user defined types
Parameters: formatId - Format id of specific type id. Parameters: baseTypeId - The Base type id Parameters: classNameWasDelimitedIdentifier - Whether or not the class namewas a delimited identifier |
equals | public boolean equals(Object that)(Code) | | we want equals to say if these are the same type id or not.
|
getApproximateLengthInBytes | public int getApproximateLengthInBytes(DataTypeDescriptor dts)(Code) | | Get the approximate length of this type in bytes.
For most datatypes this is just going to be
dts.getMaximumWidth(). Some types, such as
bit, will override this.
Parameters: dts - Data type descriptor that holds the length/precision etc. as necessary the length in bytes |
getBaseTypeId | public BaseTypeIdImpl getBaseTypeId()(Code) | | Get the base type id that is embedded in this type id. The base type
id is an object with a minimal implementation of TypeId that is intended
to be usable on the client side.
|
getBuiltInTypeId | public static TypeId getBuiltInTypeId(int JDBCTypeId)(Code) | | Get a TypeId of the given JDBC type. This factory method is
intended to be used for built-in types. For user-defined types,
we will need a factory method that takes a Java type name.
Parameters: JDBCTypeId - The JDBC Id of the type, as listed injava.sql.Types The appropriate TypeId, or null if there is no suchTypeId. |
getClassNameWasDelimitedIdentifier | public boolean getClassNameWasDelimitedIdentifier()(Code) | | For user types, tell whether or not the class name was a
delimited identifier. For all other types, return false.
Whether or not the class name was a delimited identifier. |
getCorrespondingJavaTypeName | public String getCorrespondingJavaTypeName()(Code) | | Get the name of the corresponding Java type.
Each SQL type has a corresponding Java type. When a SQL value is
passed to a Java method, it is translated to its corresponding Java
type. For example, when a SQL date column is passed to a method,
it is translated to a java.sql.Date.
The name of the corresponding Java type. |
getJDBCTypeId | final public int getJDBCTypeId()(Code) | | JDBC has its own idea of type identifiers which is different from
the Cloudscape internal type ids. The JDBC type ids are defined
as public final static ints in java.sql.Types. This method translates
a Cloudscape internal TypeId to a JDBC type id. For java objects this
returns JAVA_OBJECT in Java2 and OTHER in JDK 1.1. For Boolean datatypes,
this returns Type.BOOLEAN in JDK1.4 and Type.BIT for jdks prior to 1.4
The JDBC type Id for this type |
getMaximumMaximumWidth | public int getMaximumMaximumWidth()(Code) | | Get the maximum maximum width of the type (that's not a typo). For
types with variable length, this is the absolute maximum for the type.
The maximum maximum width of the type |
getMaximumPrecision | public int getMaximumPrecision()(Code) | | Get the maximum precision of the type. For types with variable
precision, this is an arbitrary high precision.
The maximum precision of the type |
getMaximumScale | public int getMaximumScale()(Code) | | Get the maximum scale of the type. For types with variable scale,
this is an arbitrary high scale.
The maximum scale of the type |
getPrecision | public int getPrecision(DataTypeDescriptor leftType, DataTypeDescriptor rightType)(Code) | | Get the precision of the merge of two Decimals
Parameters: leftType - the left type Parameters: rightType - the left type the resultant precision |
getResultSetMetaDataTypeName | public String getResultSetMetaDataTypeName()(Code) | | Get the name of the corresponding Java type.
This method is used directly from EmbedResultSetMetaData (jdbc)
to return the corresponding type (as choosen by getObject).
It solves a specific problem for BLOB types where the
getCorrespondingJavaTypeName() is used internall for casting
which doesn't work if changed from byte[] to java.sql.Blob.
So we do it here instread, to avoid unexpected sideeffects.
The name of the corresponding Java type. |
getSQLTypeForJavaType | public static TypeId getSQLTypeForJavaType(String javaTypeName)(Code) | | Get a TypeId for the class that corresponds to the given
Java type name.
Parameters: javaTypeName - The name of the Java type A TypeId for the SQL type that corresponds tothe Java type, null if there is no corresponding type. |
getSQLTypeName | public String getSQLTypeName()(Code) | | Returns the SQL name of the datatype. If it is a user-defined type,
it returns the full Java path name for the datatype, meaning the
dot-separated path including the package names.
A String containing the SQL name of this type. |
getScale | public int getScale(DataTypeDescriptor leftType, DataTypeDescriptor rightType)(Code) | | Get the scale of the merge of two decimals
Parameters: leftType - the left type Parameters: rightType - the left type the resultant precision |
getTypeFormatId | public int getTypeFormatId()(Code) | | Get the formatID which corresponds to this class.
the formatID of this class |
getUserDefinedTypeId | public static TypeId getUserDefinedTypeId(String className, boolean delimitedIdentifier)(Code) | | |
hashCode | public int hashCode()(Code) | | |
isBitTypeId | public boolean isBitTypeId()(Code) | | Is this a type id for a bit type?
Whether or not this a type id for a bit type. |
isBlobTypeId | public boolean isBlobTypeId()(Code) | | Is this a Blob?
true if this is BLOB |
isBooleanTypeId | public boolean isBooleanTypeId()(Code) | | Is this a type id for a boolean type?
Whether or not this a type id for a boolean type. |
isClobTypeId | public boolean isClobTypeId()(Code) | | Is this a Clob?
true if this is CLOB or NCLOB |
isConcatableTypeId | public boolean isConcatableTypeId()(Code) | | Is this a type id for a concatable type?
Whether or not this a type id for a concatable type. |
isDateTimeTimeStampTypeID | public boolean isDateTimeTimeStampTypeID()(Code) | | Is this DATE/TIME or TIMESTAMP?
true if this DATE/TIME or TIMESTAMP |
isDateTimeTimeStampTypeId | public boolean isDateTimeTimeStampTypeId()(Code) | | Is this a TypeId for DATE/TIME/TIMESTAMP
true if this is a DATE/TIME/TIMESTAMP |
isDecimalTypeId | public boolean isDecimalTypeId()(Code) | | Is this a type id for a decimal type?
Whether or not this a type id for a decimal type. |
isDoubleTypeId | public boolean isDoubleTypeId()(Code) | | Is this a TypeId for DOUBLE
true if this is a DOUBLE |
isFixedStringTypeId | public boolean isFixedStringTypeId()(Code) | | Is this a fixed string type?
true if this is CHAR or NCHAR |
isFloatingPointTypeId | public boolean isFloatingPointTypeId()(Code) | | Is this a TypeId for floating point (REAL/DOUBLE)
true if this is a REAL or DOUBLE |
isLOBTypeId | public boolean isLOBTypeId()(Code) | | Is this a type id for a LOB type?
Whether or not this a type id for a LOB type. |
isLongConcatableTypeId | public boolean isLongConcatableTypeId()(Code) | | Is this a type id for a long concatable type?
Whether or not this a type id for a long concatable type. |
isLongVarcharTypeId | public boolean isLongVarcharTypeId()(Code) | | Is this a LongVarchar?
true if this is LongVarchar |
isNationalStringTypeId | public boolean isNationalStringTypeId()(Code) | | Does this type id represent a national character string.
If this returns true then isStringTypeId will also return true.
|
isNumericTypeId | public boolean isNumericTypeId()(Code) | | Is this a type id for a numeric type?
Whether or not this a type id for a numeric type. |
isRealTypeId | public boolean isRealTypeId()(Code) | | Is this a TypeId for REAL
true if this is a REAL |
isRefTypeId | public boolean isRefTypeId()(Code) | | Is this a type id for a ref type?
Whether or not this a type id for a ref type. |
isStringTypeId | public boolean isStringTypeId()(Code) | | Does this TypeId represent a TypeId for a StringDataType.
Whether or not this TypeId represents a TypeId for a StringDataType. |
isUserDefinedTypeId | public boolean isUserDefinedTypeId()(Code) | | Is this a type id for a user defined type?
Whether or not this a type id for a user defined type. |
isXMLTypeId | public boolean isXMLTypeId()(Code) | | Is this an XML doc?
true if this is XML |
orderable | public boolean orderable(ClassFactory cf)(Code) | | Tell whether this type is orderable, that is, can participate
in comparisons.
Parameters: cf - A ClassFactory true for orderable types, false for non-orderable types. |
setNestedTypeId | public void setNestedTypeId(BaseTypeIdImpl typeId)(Code) | | Set the nested BaseTypeId in this TypeId.
|
streamStorable | public boolean streamStorable()(Code) | | Is this type StreamStorable?
true if this type has variable length. |
toParsableString | public String toParsableString(DataTypeDescriptor dts)(Code) | | Converts this TypeId, given a data type descriptor (including length/precision),
to a string. E.g.
VARCHAR(30)
For most data types, we just return the SQL type name.
Parameters: dts - Data type descriptor that holds the length/precision etc. as necessary String version of datatype, suitable for running throughthe Parser. |
typePrecedence | public int typePrecedence()(Code) | | Each built-in type in JSQL has a precedence. This precedence determines
how to do type promotion when using binary operators. For example, float
has a higher precedence than int, so when adding an int to a float, the
result type is float.
The precedence for some types is arbitrary. For example, it doesn't
matter what the precedence of the boolean type is, since it can't be
mixed with other types. But the precedence for the number types is
critical. The SQL standard requires that exact numeric types be
promoted to approximate numeric when one operator uses both. Also,
the precedence is arranged so that one will not lose precision when
promoting a type.
NOTE: char, varchar, and longvarchar must appear at the bottom of
the hierarchy, but above USER_PRECEDENCE, since we allow the implicit
conversion of those types to any other built-in system type.
The precedence of this type. |
userType | final public boolean userType()(Code) | | Tell whether this is a built-in type.
NOTE: There are 3 "classes" of types:
built-in - system provided types which are implemented internally
(int, smallint, etc.)
system built-in - system provided types, independent of implementation
(date, time, etc.)
user types - types implemented outside of the system
(java.lang.Integer, asdf.asdf.asdf, etc.)
true for built-in types, false for user-defined types. |
variableLength | public boolean variableLength()(Code) | | Does type hava a declared variable length (defined by the application).
Examples are CHAR(10), CLOB(1M).
Unbounded long types, like LONG VARCHAR return false here.
boolean true if type is variable length false if not. |
writeExternal | public void writeExternal(ObjectOutput out) throws IOException(Code) | | Write this object to a stream of stored objects.
Parameters: out - write bytes here. exception: IOException - thrown on error |
|
|
|