Top Description Constructors Methods
org.apache.derby.iapi.types

public abstract Class DataType

extends Object
implements DataValueDescriptor, Comparable
Class Inheritance
All Implemented Interfaces
java.lang.Comparable, org.apache.derby.iapi.types.DataValueDescriptor, org.apache.derby.iapi.types.Orderable, org.apache.derby.iapi.services.io.Storable, org.apache.derby.iapi.services.io.Formatable, org.apache.derby.iapi.services.io.TypedFormat, java.io.Externalizable, java.io.Serializable
Known Direct Subclasses
org.apache.derby.iapi.types.NumberDataType, org.apache.derby.iapi.types.SQLBoolean, org.apache.derby.iapi.types.SQLChar, org.apache.derby.iapi.types.SQLDate, org.apache.derby.iapi.types.SQLRef, org.apache.derby.iapi.types.SQLTime, org.apache.derby.iapi.types.SQLTimestamp, org.apache.derby.iapi.types.UserType, org.apache.derby.iapi.types.XML, org.apache.derby.impl.store.access.StorableFormatId, org.apache.derby.impl.store.access.conglomerate.GenericConglomerate, org.apache.derby.impl.store.access.heap.HeapRowLocation, org.apache.derby.iapi.types.SQLBinary
Imports
org.apache.derby.shared.common.reference.SQLState, org.apache.derby.shared.common.error.StandardException, org.apache.derby.iapi.services.io.ArrayInputStream, org.apache.derby.shared.common.sanity.SanityManager, java.io.InputStream, .IOException, java.math.BigDecimal, java.sql.Blob, .Clob, .Date, .Time, .Timestamp, .PreparedStatement, .SQLException, .ResultSet, java.util.Calendar

DataType is the superclass for all data types. It provides common behavior for datavalue descriptors -- it throws exceptions for all of the get* and setvalue(*) methods of DataValueDescriptor; the subtypes need only override the one for the type they represent and all types it can also be returned as, and the methods dealing with nulls. Since all types satisfy getString DataType does not define that interfaces of DataValueDescriptor. DataType is a little glue for columns to hold values with.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
checkHostVariable(int declaredLength)

Implements org.apache.derby.iapi.types.DataValueDescriptor.checkHostVariable.

Check the value to seem if it conforms to the restrictions imposed by DB2/JCC on host variables for this type.

public DataValueDescriptor

Returns:

A shallow clone.
cloneHolder
()

Implements org.apache.derby.iapi.types.DataValueDescriptor.cloneHolder.

Default implementation of shallow cloning, which forwards to the deep clone method.

public DataValueDescriptor
coalesce(DataValueDescriptor[]
The list of the arguments. Function will return the first non-nullable argument if any.
argumentsList
,
DataValueDescriptor
The return value is the correct datatype for this function. The return value of this method is the type of the 2nd parameter.
returnValue
)

Implements org.apache.derby.iapi.types.DataValueDescriptor.coalesce.

The SQL language COALESCE/VALUE function.

public boolean
compare(int
Orderable.ORDER_OP_EQUALS means do an = comparison. Orderable.ORDER_OP_LESSTHAN means compare this < other. Orderable.ORDER_OP_LESSOREQUALS means compare this <= other.
op
,
DataValueDescriptor
The DataValueDescriptor to compare this one to.
other
,
boolean
True means to treat nulls as ordered values, that is, treat SQL null as equal to null, and less than all other values. False means to treat nulls as unknown values, that is, the result of any comparison with a null is the UNKNOWN truth value.
orderedNulls
,
boolean
The return value to use if the result of the comparison is the UNKNOWN truth value. In other words, if orderedNulls is false, and a null is involved in the comparison, return unknownRV. This parameter is not used orderedNulls is true.
unknownRV
)

Implements org.apache.derby.iapi.types.DataValueDescriptor.compare.

Compare this Orderable with a given Orderable for the purpose of qualification and sorting.

public boolean

Returns:

true if the comparison is true (duh!)
compare
(int
Orderable.ORDER_OP_EQUALS means do an = comparison. Orderable.ORDER_OP_LESSTHAN means compare this < other. Orderable.ORDER_OP_LESSOREQUALS means compare this <= other.
op
,
DataValueDescriptor
The DataValueDescriptor to compare this one to.
other
,
boolean
True means to treat nulls as ordered values, that is, treat SQL null as equal to null, and either greater or less than all other values. False means to treat nulls as unknown values, that is, the result of any comparison with a null is the UNKNOWN truth value.
orderedNulls
,
boolean
True means NULL less than non-NULL, false means NULL greater than non-NULL. Only relevant if orderedNulls is true.
nullsOrderedLow
,
boolean
The return value to use if the result of the comparison is the UNKNOWN truth value. In other words, if orderedNulls is false, and a null is involved in the comparison, return unknownRV. This parameter is not used orderedNulls is true.
unknownRV
)

Implements org.apache.derby.iapi.types.DataValueDescriptor.compare.

Compare this Orderable with another, with configurable null ordering.

public int

Returns:

<0 - this Orderable is less than other. 0 - this Orderable equals other. >0 - this Orderable is greater than other. The code should not explicitly look for -1, or 1.
compare
(DataValueDescriptor
The Orderable to compare this one to. % @param nullsOrderedLow True if null should be lower than non-NULL
other
,
boolean nullsOrderedLow)

Implements org.apache.derby.iapi.types.DataValueDescriptor.compare.

Compare this Orderable with another, with configurable null ordering.

public int
compareTo(Object
the object to be compared.
otherDVD
)

Implements java.lang.Comparable.compareTo.

Wrapper method for the "compare(DataValueDescriptor)" method of this class.

protected final StandardException
dataTypeConversion(String targetType)

Return an conversion exception from this type to another.

public BooleanDataValue

Returns:

A SQL boolean value telling whether the two parameters are equal
equals
(DataValueDescriptor
The value on the left side of the =
left
,
DataValueDescriptor
The value on the right side of the =
right
)

Implements org.apache.derby.iapi.types.DataValueDescriptor.equals.

The = operator as called from the language module, as opposed to the storage module.

public boolean
equals(Object
the reference object with which to compare.
other
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

protected static int

Returns:

The flipped operator.
flip
(int
The operator to flip.
operator
)

Flip the operator used in a comparison (< -> >).

pack-priv void
public boolean

Returns:

The data value as a boolean.
getBoolean
()

Implements org.apache.derby.iapi.types.DataValueDescriptor.getBoolean.

Gets the value in the data value descriptor as a boolean.

public byte

Returns:

The data value as a byte.
getByte
()

Implements org.apache.derby.iapi.types.DataValueDescriptor.getByte.

Gets the value in the data value descriptor as a byte.

public byte[]

Returns:

The Binary value as a byte[].
getBytes
()

Implements org.apache.derby.iapi.types.DataValueDescriptor.getBytes.

Gets the value in the data value descriptor as a byte[].

public Date

Returns:

The data value as a java.sql.Date.
getDate
(Calendar
calendar for object creation
cal
)

Implements org.apache.derby.iapi.types.DataValueDescriptor.getDate.

Gets the value in the data value descriptor as a java.sql.Date.

public double

Returns:

The data value as a double.
getDouble
()

Implements org.apache.derby.iapi.types.DataValueDescriptor.getDouble.

Gets the value in the data value descriptor as a double.

public float

Returns:

The data value as a float.
getFloat
()

Implements org.apache.derby.iapi.types.DataValueDescriptor.getFloat.

Gets the value in the data value descriptor as a float.

public int

Returns:

The data value as a int.
getInt
()

Implements org.apache.derby.iapi.types.DataValueDescriptor.getInt.

Gets the value in the data value descriptor as a int.

public long

Returns:

The data value as a long.
getLong
()

Implements org.apache.derby.iapi.types.DataValueDescriptor.getLong.

Gets the value in the data value descriptor as a long.

public Object

Returns:

The data value as a int.
getObject
()

Implements org.apache.derby.iapi.types.DataValueDescriptor.getObject.

Gets the value in the data value descriptor as a int.

public short

Returns:

The data value as a short.
getShort
()

Implements org.apache.derby.iapi.types.DataValueDescriptor.getShort.

Gets the value in the data value descriptor as a short.

public InputStream

Returns:

The data value as an InputStream.
getStream
()

Implements org.apache.derby.iapi.types.DataValueDescriptor.getStream.

Gets the value in the data stream descriptor as an InputStream.

public Time

Returns:

The data value as a java.sql.Time.
getTime
(Calendar
calendar for object creation
cal
)

Implements org.apache.derby.iapi.types.DataValueDescriptor.getTime.

Gets the value in the data value descriptor as a java.sql.Time.

public Timestamp

Returns:

The data value as a java.sql.Timestamp.
getTimestamp
(Calendar
calendar for object creation
cal
)

Implements org.apache.derby.iapi.types.DataValueDescriptor.getTimestamp.

Gets the value in the data value descriptor as a java.sql.Timestamp.

public String

Returns:

The data value in a representation suitable for tracing.
getTraceString
()

Implements org.apache.derby.iapi.types.DataValueDescriptor.getTraceString.

Gets the value in the data stream descriptor as a trace string.

pack-priv String
getTypeName(String className)

Get the type name of this value, possibly overriding with the passed in class name (for user/java types).

public BooleanDataValue

Returns:

A SQL boolean value telling whether the first operand is greater than or equal to the second operand
greaterOrEquals
(DataValueDescriptor
The value on the left side of the >=
left
,
DataValueDescriptor
The value on the right side of the >=
right
)

Implements org.apache.derby.iapi.types.DataValueDescriptor.greaterOrEquals.

The >= operator as called from the language module, as opposed to the storage module.

public BooleanDataValue

Returns:

A SQL boolean value telling whether the first operand is greater than the second operand
greaterThan
(DataValueDescriptor
The value on the left side of the >
left
,
DataValueDescriptor
The value on the right side of the >
right
)

Implements org.apache.derby.iapi.types.DataValueDescriptor.greaterThan.

The > operator as called from the language module, as opposed to the storage module.

public boolean

Returns:

false
hasStream
()

Implements org.apache.derby.iapi.types.DataValueDescriptor.hasStream.

Tells that the value isn't represented as a stream, which is true for most Derby data types.

public BooleanDataValue
in(DataValueDescriptor
The value on the left side of the operator
left
,
DataValueDescriptor[]
The values in the IN list
inList
,
boolean
True means that the values in the IN list are ordered, false means they are not.
orderedList
)

Implements org.apache.derby.iapi.types.DataValueDescriptor.in.

The SQL language IN operator.

protected final StandardException
invalidFormat()

Return an out of range exception for this type.

public final BooleanDataValue

Returns:

A SQL boolean value telling whether the operand is not null
isNotNull
()

Implements org.apache.derby.iapi.types.DataValueDescriptor.isNotNull.

The is not null operator as called from the language module, as opposed to the storage module.

public final BooleanDataValue

Returns:

A SQL boolean value telling whether the operand is null
isNullOp
()

Implements org.apache.derby.iapi.types.DataValueDescriptor.isNullOp.

The is null operator as called from the language module, as opposed to the storage module.

public BooleanDataValue

Returns:

A SQL boolean value telling whether the first operand is less than or equal to the second operand
lessOrEquals
(DataValueDescriptor
The value on the left side of the <=
left
,
DataValueDescriptor
The value on the right side of the <=
right
)

Implements org.apache.derby.iapi.types.DataValueDescriptor.lessOrEquals.

The <= operator as called from the language module, as opposed to the storage module.

public BooleanDataValue

Returns:

A SQL boolean value telling whether the first operand is less than the second operand
lessThan
(DataValueDescriptor
The value on the left side of the <
left
,
DataValueDescriptor
The value on the right side of the <
right
)

Implements org.apache.derby.iapi.types.DataValueDescriptor.lessThan.

The < operator as called from the language module, as opposed to the storage module.

public void
normalize(DataTypeDescriptor
The type to normalize the source column to
desiredType
,
DataValueDescriptor
The value to normalize
source
)

Implements org.apache.derby.iapi.types.DataValueDescriptor.normalize.

Default normalization method.

public BooleanDataValue

Returns:

A SQL boolean value telling whether the two parameters are not equal
notEquals
(DataValueDescriptor
The value on the left side of the <>
left
,
DataValueDescriptor
The value on the right side of the <>
right
)

Implements org.apache.derby.iapi.types.DataValueDescriptor.notEquals.

The <> operator as called from the language module, as opposed to the storage module.

protected final StandardException
outOfRange()

Return an out of range exception for this type.

public void
readExternalFromArray(ArrayInputStream
The array stream positioned at the beginning of the byte stream to read from.
in
)

Implements org.apache.derby.iapi.types.DataValueDescriptor.readExternalFromArray.

Read the DataValueDescriptor from the stream.

public DataValueDescriptor

Returns:

this object with value set to null
recycle
()

Implements org.apache.derby.iapi.types.DataValueDescriptor.recycle.

Recycle this DataType object.

public void
setBigDecimal(BigDecimal
required to be a BigDecimal or null.
bigDecimal
)

Implements org.apache.derby.iapi.types.DataValueDescriptor.setBigDecimal.

Only to be called when the application sets a value using BigDecimal

protected void
setFrom(DataValueDescriptor
The DataValueDescriptor that holds the value to which we want to set this DataValueDescriptor's value.
dvd
)

Set the value of this DataValueDescriptor based on the value of the specified DataValueDescriptor.

public void
setInto(PreparedStatement ps, int position)

Implements org.apache.derby.iapi.types.DataValueDescriptor.setInto.

Set this value into a PreparedStatement.

public void
setInto(ResultSet rs, int position)

Implements org.apache.derby.iapi.types.DataValueDescriptor.setInto.

Set this value into a ResultSet for a subsequent ResultSet.insertRow or ResultSet.updateRow.

pack-priv void
setObject(Object theValue)

Set the value from an non-null object.

public void
setObjectForCast(Object
The new value
theValue
,
boolean
Whether or not the new value is an instanceof the result type.
instanceOfResultType
,
String
The class name of the resulting (declared) type (for error messages only).
resultTypeClassName
)

Implements org.apache.derby.iapi.types.DataValueDescriptor.setObjectForCast.

Set this value from an Object.

public void
public void
setValue(Time
The Time value to set this DataValueDescriptor to
theValue
)

Implements org.apache.derby.iapi.types.DataValueDescriptor.setValue.

Set the value of this DataValueDescriptor.

public void
setValue(Time
The Time value to set this DataValueDescriptor to
theValue
,
Calendar
The time zone from the calendar is used to construct the database time value
cal
)

Implements org.apache.derby.iapi.types.DataValueDescriptor.setValue.

Set the value of this DataValueDescriptor.

public void
setValue(Timestamp
The Timestamp value to set this DataValueDescriptor to
theValue
)

Implements org.apache.derby.iapi.types.DataValueDescriptor.setValue.

Set the value of this DataValueDescriptor.

public void
setValue(Timestamp
The Timestamp value to set this DataValueDescriptor to
theValue
,
Calendar
The time zone from the calendar is used to construct the database timestamp value
cal
)

Implements org.apache.derby.iapi.types.DataValueDescriptor.setValue.

Set the value of this DataValueDescriptor.

public void
setValue(Date
The Date value to set this DataValueDescriptor to
theValue
)

Implements org.apache.derby.iapi.types.DataValueDescriptor.setValue.

Set the value of this DataValueDescriptor.

public void
setValue(Date
The Date value to set this DataValueDescriptor to
theValue
,
Calendar
The time zone from the calendar is used to construct the database date value
cal
)

Implements org.apache.derby.iapi.types.DataValueDescriptor.setValue.

Set the value of this DataValueDescriptor.

public void
setValue(Object
The Object value to set this DataValueDescriptor to
theValue
)

Implements org.apache.derby.iapi.types.DataValueDescriptor.setValue.

Set the value of this DataValueDescriptor.

public void
setValue(String
The BigDecimal value to set this DataValueDescriptor to
theValue
)

Implements org.apache.derby.iapi.types.DataValueDescriptor.setValue.

Set the value of this DataValueDescriptor.

public void
setValue(Blob
The Blob value to set this DataValueDescriptor to
theValue
)

Implements org.apache.derby.iapi.types.DataValueDescriptor.setValue.

Set the value of this DataValueDescriptor.

public void
setValue(Clob
The Clob value to set this DataValueDescriptor to
theValue
)

Implements org.apache.derby.iapi.types.DataValueDescriptor.setValue.

Set the value of this DataValueDescriptor.

public void
setValue(int
The value to set this DataValueDescriptor to
theValue
)

Implements org.apache.derby.iapi.types.DataValueDescriptor.setValue.

Set the value of this DataValueDescriptor to the given int value At DataType level just throws an error lower classes will override

public void
setValue(double
The value to set this DataValueDescriptor to
theValue
)

Implements org.apache.derby.iapi.types.DataValueDescriptor.setValue.

Set the value of this DataValueDescriptor to the given double value At DataType level just throws an error lower classes will override

public void
setValue(float
The value to set this DataValueDescriptor to
theValue
)

Implements org.apache.derby.iapi.types.DataValueDescriptor.setValue.

Set the value of this DataValueDescriptor to the given float value At DataType level just throws an error lower classes will override

public void
setValue(short
The value to set this DataValueDescriptor to
theValue
)

Implements org.apache.derby.iapi.types.DataValueDescriptor.setValue.

Set the value of this DataValueDescriptor to the given short value At DataType level just throws an error lower classes will override

public void
setValue(long
The value to set this DataValueDescriptor to
theValue
)

Implements org.apache.derby.iapi.types.DataValueDescriptor.setValue.

Set the value of this DataValueDescriptor to the given long value At DataType level just throws an error lower classes will override

public void
setValue(byte
The value to set this DataValueDescriptor to
theValue
)

Implements org.apache.derby.iapi.types.DataValueDescriptor.setValue.

Set the value of this DataValueDescriptor to the given byte value At DataType level just throws an error lower classes will override

public void
setValue(boolean
Contains the boolean value to set this to
theValue
)

Implements org.apache.derby.iapi.types.DataValueDescriptor.setValue.

Set the value.

public void
setValue(byte[]
The byte value to set this DataValueDescriptor to
theValue
)

Implements org.apache.derby.iapi.types.DataValueDescriptor.setValue.

Set the value of this DataValueDescriptor.

public final void
setValue(DataValueDescriptor
The Date value to set this DataValueDescriptor to
dvd
)

Implements org.apache.derby.iapi.types.DataValueDescriptor.setValue.

Set the value of this DataValueDescriptor from another.

public void
setValue(InputStream
stream of correctly formatted data
theStream
,
int
logical length of the stream's value in units of this type (e.g. chars for string types), or UNKNOWN_LOGICAL_LENGTH if the logical length is unknown
valueLength
)

Implements org.apache.derby.iapi.types.DataValueDescriptor.setValue.

Set the value to be the contents of the stream.

public void
pack-priv void
public int

Returns:

The precedence of this type.
typePrecedence
()

Implements org.apache.derby.iapi.types.DataValueDescriptor.typePrecedence.

Each built-in type in JSQL has a precedence.

public int
typeToBigDecimal()

Implements org.apache.derby.iapi.types.DataValueDescriptor.typeToBigDecimal.

How should this value be obtained so that it can be converted to a BigDecimal representation.

Inherited from java.lang.Object:
clonefinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait