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

public Interface DataValueDescriptor

extends Storable, Orderable
Known Direct Subinterfaces
org.apache.derby.iapi.types.DateTimeDataValue, org.apache.derby.iapi.types.NumberDataValue, org.apache.derby.iapi.types.RefDataValue, org.apache.derby.iapi.types.RowLocation, org.apache.derby.iapi.types.UserDataValue, org.apache.derby.iapi.types.XMLDataValue, org.apache.derby.iapi.store.access.conglomerate.Conglomerate, org.apache.derby.iapi.types.BooleanDataValue, org.apache.derby.iapi.types.ConcatableDataValue
Known Direct Implementers
org.apache.derby.iapi.types.DataType
Imports
org.apache.derby.iapi.services.io.ArrayInputStream, .Storable, org.apache.derby.shared.common.error.StandardException, java.io.InputStream, .IOException, java.math.BigDecimal, java.sql.Blob, .Clob, .Date, .ResultSet, .PreparedStatement, .Time, .Timestamp, .SQLException, java.util.Calendar

The DataValueDescriptor interface provides methods to get the data from a column returned by a statement.

This interface matches the getXXX methods on java.sql.ResultSet. This means everyone satisfies getString and getObject; all of the numeric types, within the limits of representation, satisfy all of the numeric getXXX methods; all of the character types satisfy all of the getXXX methods except getBytes and getBinaryStream; all of the binary types satisfy getBytes and all of the getXXXStream methods; Date satisfies getDate and getTimestamp; Time satisfies getTime; and Timestamp satisfies all of the date/time getXXX methods. The "preferred" method (one that will always work, I presume) is the one that matches the type most closely. See the comments below for "preferences". See the JDBC guide for details.

This interface does not include the getXXXStream methods.

The preferred methods for JDBC are:

CHAR and VARCHAR - getString()

BIT - getBoolean()

TINYINT - getByte()

SMALLINT - getShort()

INTEGER - getInt()

BIGINT - getLong()

REAL - getFloat()

FLOAT and DOUBLE - getDouble()

DECIMAL and NUMERIC - getBigDecimal()

BINARY and VARBINARY - getBytes()

DATE - getDate()

TIME - getTime()

TIMESTAMP - getTimestamp()

No JDBC type corresponds to getObject(). Use this for user-defined types or to get the JDBC types as java Objects. All primitive types will be wrapped in their corresponding Object type, i.e. int will be wrapped in an Integer.

getStream()

Field Summary

Modifier and TypeField and Description
public static final int
UNKNOWN_LOGICAL_LENGTH

Constant indicating that the logical length of a value (i.e. chars for string types or bytes for binary types) is unknown.

Inherited from org.apache.derby.iapi.types.Orderable:
ORDER_OP_EQUALSORDER_OP_GREATEROREQUALSORDER_OP_GREATERTHANORDER_OP_LESSOREQUALSORDER_OP_LESSTHAN

Method Summary

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

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 clone of this descriptor, which shares the internal state.
cloneHolder
()

Get a shallow copy of this codeDataValueDescriptor (DVD).

public DataValueDescriptor

Returns:

A clone of the DataValueDescriptor with the same initial value as this.
cloneValue
(boolean
any streams representing the data value will be materialized if true, the data value will be kept as a stream if possible if false
forceMaterialization
)

Clone this DataValueDescriptor.

public DataValueDescriptor

Returns:

A DataValueDescriptor which will be either null or first non-null argument
coalesce
(DataValueDescriptor[]
The list of the arguments. Function will return the first non-nullable argument if any.
list
,
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
)

The SQL language COALESCE/VALUE function.

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.
other
)

Compare this Orderable with a given Orderable for the purpose of index positioning.

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)

Compare this Orderable with another, with configurable null ordering.

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 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
)

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
)

Compare this Orderable with another, with configurable null ordering.

public BooleanDataValue

Returns:

A BooleanDataValue telling the result of the comparison
equals
(DataValueDescriptor
The value on the left side of the operator
left
,
DataValueDescriptor
The value on the right side of the operator
right
)

The SQL language = operator.

public int

Returns:

the estimated memory usage
estimateMemoryUsage
()

Estimate the memory usage in bytes of the data value and the overhead of the class.

public boolean

Returns:

The data value as a boolean.
getBoolean
()

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

public byte

Returns:

The data value as a byte.
getByte
()

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

public byte[]

Returns:

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

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

public Date

Returns:

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

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

public double

Returns:

The data value as a double.
getDouble
()

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

public float

Returns:

The data value as a float.
getFloat
()

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

public int

Returns:

The data value as a int.
getInt
()

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

public int

Returns:

The length of the data value
getLength
()

Gets the length of the data value.

public long

Returns:

The data value as a long.
getLong
()

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

public DataValueDescriptor
getNewNull()

Get a new null value of the same type as this data value.

public Object

Returns:

The data value as an Object.
getObject
()

Gets the value in the data value descriptor as a Java Object.

public short

Returns:

The data value as a short.
getShort
()

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

public InputStream

Returns:

The stream state of the data value.
getStream
()

Gets the value in the data value descriptor as a stream of bytes.

public String

Returns:

The data value as a String.
getString
()

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

public Time

Returns:

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

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
)

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

public String
getTraceString()

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

public String

Returns:

The SQL name of the datatype
getTypeName
()

Get the SQL name of the datatype

public BooleanDataValue

Returns:

A BooleanDataValue telling the result of the comparison
greaterOrEquals
(DataValueDescriptor
The value on the left side of the operator
left
,
DataValueDescriptor
The value on the right side of the operator
right
)

The SQL language >= operator.

public BooleanDataValue

Returns:

A BooleanDataValue telling the result of the comparison
greaterThan
(DataValueDescriptor
The value on the left side of the operator
left
,
DataValueDescriptor
The value on the right side of the operator
right
)

The SQL language > operator.

public boolean

Returns:

true if the value will be a stream, false otherwise.
hasStream
()

Tells if this data value is, or will be, represented by a stream.

public BooleanDataValue

Returns:

A BooleanDataValue telling the result of the comparison
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
)

The SQL language IN operator.

public BooleanDataValue

Returns:

True if this value is not null.
isNotNull
()

The SQL "IS NOT NULL" operator.

public BooleanDataValue

Returns:

True if this value is null.
isNullOp
()

The SQL "IS NULL" operator.

public BooleanDataValue

Returns:

A BooleanDataValue telling the result of the comparison
lessOrEquals
(DataValueDescriptor
The value on the left side of the operator
left
,
DataValueDescriptor
The value on the right side of the operator
right
)

The SQL language <= operator.

public BooleanDataValue

Returns:

A BooleanDataValue telling the result of the comparison
lessThan
(DataValueDescriptor
The value on the left side of the operator
left
,
DataValueDescriptor
The value on the right side of the operator
right
)

The SQL language < operator.

public void
normalize(DataTypeDescriptor dtd, DataValueDescriptor source)

Normalize the source value to this type described by this class and the passed in DataTypeDescriptor.

public BooleanDataValue

Returns:

A BooleanDataValue telling the result of the comparison
notEquals
(DataValueDescriptor
The value on the left side of the operator
left
,
DataValueDescriptor
The value on the right side of the operator
right
)

The SQL language <> operator.

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

Read the DataValueDescriptor from the stream.

public DataValueDescriptor

Returns:

this object with the value set to null, or a new DataValueDescriptor of the same type as this
recycle
()

Recycle this DataValueDescriptor if possible.

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

Set this value from an application supplied java.math.BigDecimal.

public void
setInto(PreparedStatement ps, int position)

Set this value into a PreparedStatement.

public void
setInto(ResultSet rs, int position)

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

public void
setObjectForCast(Object
The new value
value
,
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
)

Set this value from an Object.

public void
setToNull()

Set the value to SQL null.

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

Set the value of this DataValueDescriptor to the given int value

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

Set the value of this DataValueDescriptor to the given double value

public void
setValue(float
A Double containing the value to set this DataValueDescriptor to. Null means set the value to SQL null.
theValue
)

Set the value of this DataValueDescriptor to the given double value

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

Set the value of this DataValueDescriptor to the given short value

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

Set the value of this DataValueDescriptor to the given long value

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

Set the value of this DataValueDescriptor to the given byte value

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

Set the value.

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

Set the value of this DataValueDescriptor to the given Object value

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

Set the value of this DataValueDescriptor.

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

Set the value of this DataValueDescriptor.

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

Set the value of this DataValueDescriptor from a Blob.

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

Set the value of this DataValueDescriptor from a Clob.

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

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
)

Set the value of this DataValueDescriptor.

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

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
)

Set the value of this DataValueDescriptor.

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

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
)

Set the value of this DataValueDescriptor.

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

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
)

Set the value to be the contents of the stream.

public void
setValueFromResultSet(ResultSet
The specified ResultSet.
resultSet
,
int
The 1-based column # into the resultSet.
colNumber
,
boolean
Whether or not the column is nullable (No need to call wasNull() if not)
isNullable
)

Set the value based on the value for the specified DataValueDescriptor from the specified ResultSet.

public int

Returns:

The precedence of this type.
typePrecedence
()

Each built-in type in JSQL has a precedence.

public int

Returns:

Types.CHAR for String conversion through getString Types.DECIMAL for BigDecimal through getObject or Types.BIGINT for long conversion through getLong
typeToBigDecimal
()

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

Inherited from org.apache.derby.iapi.services.io.Storable:
isNullrestoreToNull