|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.derby.iapi.types.DataType
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.
Field Summary |
Fields inherited from interface org.apache.derby.iapi.types.Orderable |
ORDER_OP_EQUALS, ORDER_OP_GREATEROREQUALS, ORDER_OP_GREATERTHAN, ORDER_OP_LESSOREQUALS, ORDER_OP_LESSTHAN |
Constructor Summary | |
DataType()
|
Method Summary | |
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. |
java.lang.Object |
cloneObject()
From CloneableObject |
DataValueDescriptor |
coalesce(DataValueDescriptor[] argumentsList,
DataValueDescriptor returnValue)
The SQL language COALESCE/VALUE function. |
boolean |
compare(int op,
DataValueDescriptor other,
boolean orderedNulls,
boolean unknownRV)
Compare this Orderable with a given Orderable for the purpose of qualification and sorting. |
protected StandardException |
dataTypeConversion(java.lang.String targetType)
Return an conversion exception for this type. |
BooleanDataValue |
equals(DataValueDescriptor left,
DataValueDescriptor right)
The = operator as called from the language module, as opposed to the storage module. |
boolean |
equals(java.lang.Object other)
|
protected static int |
flip(int operator)
Flip the operator used in a comparison (< -> >). |
protected void |
genericSetObject(java.lang.Object theValue)
|
boolean |
getBoolean()
Gets the value in the data value descriptor as a boolean. |
byte |
getByte()
Gets the value in the data value descriptor as a byte. |
byte[] |
getBytes()
Gets the value in the data value descriptor as a byte[]. |
java.sql.Date |
getDate(java.util.Calendar cal)
Gets the value in the data value descriptor as a java.sql.Date. |
double |
getDouble()
Gets the value in the data value descriptor as a double. |
float |
getFloat()
Gets the value in the data value descriptor as a float. |
int |
getInt()
Gets the value in the data value descriptor as a int. |
long |
getLong()
Gets the value in the data value descriptor as a long. |
protected java.lang.String |
getNationalString(LocaleFinder localeFinder)
International version of getString(). |
java.lang.Object |
getObject()
Gets the value in the data value descriptor as a int. |
short |
getShort()
Gets the value in the data value descriptor as a short. |
java.io.InputStream |
getStream()
Gets the value in the data stream descriptor as an InputStream. |
java.sql.Time |
getTime(java.util.Calendar cal)
Gets the value in the data value descriptor as a java.sql.Time. |
java.sql.Timestamp |
getTimestamp(java.util.Calendar cal)
Gets the value in the data value descriptor as a java.sql.Timestamp. |
BooleanDataValue |
greaterOrEquals(DataValueDescriptor left,
DataValueDescriptor right)
The >= operator as called from the language module, as opposed to the storage module. |
BooleanDataValue |
greaterThan(DataValueDescriptor left,
DataValueDescriptor right)
The > operator as called from the language module, as opposed to the storage module. |
BooleanDataValue |
in(DataValueDescriptor left,
DataValueDescriptor[] inList,
boolean orderedList)
The SQL language IN operator. |
protected StandardException |
invalidFormat()
Return an out of range exception for this type. |
BooleanDataValue |
isNotNull()
The is not null operator as called from the language module, as opposed to the storage module. |
BooleanDataValue |
isNullOp()
The is null operator as called from the language module, as opposed to the storage module. |
BooleanDataValue |
lessOrEquals(DataValueDescriptor left,
DataValueDescriptor right)
The <= operator as called from the language module, as opposed to the storage module. |
BooleanDataValue |
lessThan(DataValueDescriptor left,
DataValueDescriptor right)
The < operator as called from the language module, as opposed to the storage module. |
void |
normalize(DataTypeDescriptor desiredType,
DataValueDescriptor source)
Default normalization method. |
BooleanDataValue |
notEquals(DataValueDescriptor left,
DataValueDescriptor right)
The <> operator as called from the language module, as opposed to the storage module. |
protected StandardException |
outOfRange()
Return an out of range exception for this type. |
void |
setBigDecimal(java.lang.Number bigDecimal)
Only to be called when the application sets a value using BigDecimal |
protected void |
setFrom(DataValueDescriptor dvd)
|
void |
setInto(java.sql.PreparedStatement ps,
int position)
Set this value into a PreparedStatement. |
void |
setInto(java.sql.ResultSet rs,
int position)
Set this value into a ResultSet for a subsequent ResultSet.insertRow or ResultSet.updateRow. |
void |
setObjectForCast(java.lang.Object value,
boolean instanceOf,
java.lang.String resultTypeClassName)
Set the Object that this Data Type contains (for an explicit cast). |
void |
setToNull()
Set the value to SQL null. |
void |
setValue(boolean theValue)
Set the value. |
void |
setValue(byte theValue)
Set the value of this DataValueDescriptor to the given byte value At DataType level just throws an error lower classes will override |
void |
setValue(byte[] theValue)
Set the value of this DataValueDescriptor. |
void |
setValue(DataValueDescriptor dvd)
Set the value of this DataValueDescriptor from another. |
void |
setValue(java.sql.Date theValue)
Set the value of this DataValueDescriptor. |
void |
setValue(java.sql.Date theValue,
java.util.Calendar cal)
Set the value of this DataValueDescriptor. |
void |
setValue(double theValue)
Set the value of this DataValueDescriptor to the given double value At DataType level just throws an error lower classes will override |
void |
setValue(float theValue)
Set the value of this DataValueDescriptor to the given float value At DataType level just throws an error lower classes will override |
void |
setValue(java.io.InputStream theStream,
int streamLength)
Set the value to be the contents of the stream. |
void |
setValue(int theValue)
Set the value of this DataValueDescriptor to the given int value At DataType level just throws an error lower classes will override |
void |
setValue(long theValue)
Set the value of this DataValueDescriptor to the given long value At DataType level just throws an error lower classes will override |
void |
setValue(java.lang.Object theValue)
Set the value from an object. |
void |
setValue(short theValue)
Set the value of this DataValueDescriptor to the given short value At DataType level just throws an error lower classes will override |
void |
setValue(java.lang.String theValue)
Set the value of this DataValueDescriptor. |
void |
setValue(java.sql.Time theValue)
Set the value of this DataValueDescriptor. |
void |
setValue(java.sql.Time theValue,
java.util.Calendar cal)
Set the value of this DataValueDescriptor. |
void |
setValue(java.sql.Timestamp theValue)
Set the value of this DataValueDescriptor. |
void |
setValue(java.sql.Timestamp theValue,
java.util.Calendar cal)
Set the value of this DataValueDescriptor. |
void |
throwLangSetMismatch(java.lang.Object value)
|
(package private) void |
throwLangSetMismatch(java.lang.String argTypeName)
|
int |
typePrecedence()
Each built-in type in JSQL has a precedence. |
int |
typeToBigDecimal()
How should this value be obtained so that it can be converted to a BigDecimal representation. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.apache.derby.iapi.types.DataValueDescriptor |
compare, estimateMemoryUsage, getClone, getLength, getNewNull, getString, getTypeName, readExternalFromArray, setValueFromResultSet |
Methods inherited from interface org.apache.derby.iapi.services.io.Storable |
isNull, restoreToNull |
Methods inherited from interface java.io.Externalizable |
readExternal, writeExternal |
Methods inherited from interface org.apache.derby.iapi.services.io.TypedFormat |
getTypeFormatId |
Constructor Detail |
public DataType()
Method Detail |
public boolean getBoolean() throws StandardException
getBoolean
in interface DataValueDescriptor
StandardException
- Thrown on errorpublic byte getByte() throws StandardException
getByte
in interface DataValueDescriptor
StandardException
- Thrown on errorpublic short getShort() throws StandardException
getShort
in interface DataValueDescriptor
StandardException
- Thrown on errorpublic int getInt() throws StandardException
getInt
in interface DataValueDescriptor
StandardException
- Thrown on errorpublic long getLong() throws StandardException
getLong
in interface DataValueDescriptor
StandardException
- Thrown on errorpublic float getFloat() throws StandardException
getFloat
in interface DataValueDescriptor
StandardException
- Thrown on errorpublic double getDouble() throws StandardException
getDouble
in interface DataValueDescriptor
StandardException
- Thrown on errorpublic int typeToBigDecimal() throws StandardException
DataValueDescriptor
typeToBigDecimal
in interface DataValueDescriptor
StandardException
- Conversion is not possiblepublic byte[] getBytes() throws StandardException
getBytes
in interface DataValueDescriptor
StandardException
- Thrown on errorpublic java.sql.Date getDate(java.util.Calendar cal) throws StandardException
getDate
in interface DataValueDescriptor
cal
- calendar for object creation
StandardException
- Thrown on errorpublic java.sql.Time getTime(java.util.Calendar cal) throws StandardException
getTime
in interface DataValueDescriptor
cal
- calendar for object creation
StandardException
- Thrown on errorpublic java.sql.Timestamp getTimestamp(java.util.Calendar cal) throws StandardException
getTimestamp
in interface DataValueDescriptor
cal
- calendar for object creation
StandardException
- Thrown on errorpublic java.io.InputStream getStream() throws StandardException
getStream
in interface DataValueDescriptor
StandardException
- Thrown on errorpublic final BooleanDataValue isNullOp()
isNullOp
in interface DataValueDescriptor
public final BooleanDataValue isNotNull()
isNotNull
in interface DataValueDescriptor
public void setValue(java.sql.Time theValue) throws StandardException
setValue
in interface DataValueDescriptor
theValue
- The Time value to set this DataValueDescriptor to
StandardException
public void setValue(java.sql.Time theValue, java.util.Calendar cal) throws StandardException
setValue
in interface DataValueDescriptor
theValue
- The Time value to set this DataValueDescriptor tocal
- The time zone from the calendar is used to construct the database time value
StandardException
public void setValue(java.sql.Timestamp theValue) throws StandardException
setValue
in interface DataValueDescriptor
theValue
- The Timestamp value to set this DataValueDescriptor to
StandardException
public void setValue(java.sql.Timestamp theValue, java.util.Calendar cal) throws StandardException
setValue
in interface DataValueDescriptor
theValue
- The Timestamp value to set this DataValueDescriptor tocal
- The time zone from the calendar is used to construct the database timestamp value
StandardException
public void setValue(java.sql.Date theValue) throws StandardException
setValue
in interface DataValueDescriptor
theValue
- The Date value to set this DataValueDescriptor to
StandardException
public void setValue(java.sql.Date theValue, java.util.Calendar cal) throws StandardException
setValue
in interface DataValueDescriptor
theValue
- The Date value to set this DataValueDescriptor tocal
- The time zone from the calendar is used to construct the database date value
StandardException
public void setValue(java.lang.String theValue) throws StandardException
setValue
in interface DataValueDescriptor
theValue
- The BigDecimal value to set this DataValueDescriptor to
StandardException
public void setValue(int theValue) throws StandardException
setValue
in interface DataValueDescriptor
theValue
- The value to set this DataValueDescriptor to
StandardException
- Thrown on errorpublic void setValue(double theValue) throws StandardException
setValue
in interface DataValueDescriptor
theValue
- The value to set this DataValueDescriptor to
StandardException
- Thrown on errorpublic void setValue(float theValue) throws StandardException
setValue
in interface DataValueDescriptor
theValue
- The value to set this DataValueDescriptor to
StandardException
- Thrown on errorpublic void setValue(short theValue) throws StandardException
setValue
in interface DataValueDescriptor
theValue
- The value to set this DataValueDescriptor to
StandardException
- Thrown on errorpublic void setValue(long theValue) throws StandardException
setValue
in interface DataValueDescriptor
theValue
- The value to set this DataValueDescriptor to
StandardException
- Thrown on errorpublic void setValue(byte theValue) throws StandardException
setValue
in interface DataValueDescriptor
theValue
- The value to set this DataValueDescriptor to
StandardException
- Thrown on errorpublic void setValue(boolean theValue) throws StandardException
setValue
in interface DataValueDescriptor
theValue
- Contains the boolean value to set this to
StandardException
public void setValue(byte[] theValue) throws StandardException
setValue
in interface DataValueDescriptor
theValue
- The byte value to set this DataValueDescriptor to
StandardException
public void setBigDecimal(java.lang.Number bigDecimal) throws StandardException
setBigDecimal
in interface DataValueDescriptor
bigDecimal
- required to be a BigDecimal or null.
StandardException
public final void setValue(DataValueDescriptor dvd) throws StandardException
DataValueDescriptor
setValue
in interface DataValueDescriptor
dvd
- The Date value to set this DataValueDescriptor to
StandardException
protected void setFrom(DataValueDescriptor dvd) throws StandardException
StandardException
public void setToNull()
DataValueDescriptor
setToNull
in interface DataValueDescriptor
DataValueDescriptor.setToNull()
public void setObjectForCast(java.lang.Object value, boolean instanceOf, java.lang.String resultTypeClassName) throws StandardException
setObjectForCast
in interface DataValueDescriptor
value
- The new valueinstanceOf
- Whether or not the new value
is an instanceof the result type.resultTypeClassName
- The class name of the resulting type
(for error messages only).
StandardException
- Thrown on errorpublic void setValue(java.lang.Object theValue) throws StandardException
setValue
in interface DataValueDescriptor
theValue
- An Object containing the value to set this
DataValueDescriptor to. Null means set the value
to SQL null.
StandardException
- Thrown on errorpublic java.lang.Object getObject() throws StandardException
getObject
in interface DataValueDescriptor
StandardException
- Thrown on errorprotected void genericSetObject(java.lang.Object theValue) throws StandardException
StandardException
public java.lang.Object cloneObject()
cloneObject
in interface CloneableObject
protected java.lang.String getNationalString(LocaleFinder localeFinder) throws StandardException
StandardException
- Thrown on errorpublic void throwLangSetMismatch(java.lang.Object value) throws StandardException
StandardException
void throwLangSetMismatch(java.lang.String argTypeName) throws StandardException
StandardException
public void setInto(java.sql.PreparedStatement ps, int position) throws java.sql.SQLException, StandardException
DataValueDescriptor
setInto
in interface DataValueDescriptor
java.sql.SQLException
- thrown by the PreparedStatement object
StandardException
- thrown by me accessing my value.public void setInto(java.sql.ResultSet rs, int position) throws java.sql.SQLException, StandardException
setInto
in interface DataValueDescriptor
java.sql.SQLException
- thrown by the ResultSet object
StandardException
- thrown by me accessing my value.public void normalize(DataTypeDescriptor desiredType, DataValueDescriptor source) throws StandardException
normalize
in interface DataValueDescriptor
desiredType
- The type to normalize the source column tosource
- The value to normalize
StandardException
- Thrown normalization error.public int typePrecedence()
typePrecedence
in interface DataValueDescriptor
public BooleanDataValue equals(DataValueDescriptor left, DataValueDescriptor right) throws StandardException
equals
in interface DataValueDescriptor
left
- The value on the left side of the =right
- The value on the right side of the =
StandardException
- Thrown on errorpublic BooleanDataValue notEquals(DataValueDescriptor left, DataValueDescriptor right) throws StandardException
notEquals
in interface DataValueDescriptor
left
- The value on the left side of the <>right
- The value on the right side of the <>
StandardException
- Thrown on errorpublic BooleanDataValue lessThan(DataValueDescriptor left, DataValueDescriptor right) throws StandardException
lessThan
in interface DataValueDescriptor
left
- The value on the left side of the <right
- The value on the right side of the <
StandardException
- Thrown on errorpublic BooleanDataValue greaterThan(DataValueDescriptor left, DataValueDescriptor right) throws StandardException
greaterThan
in interface DataValueDescriptor
left
- The value on the left side of the >right
- The value on the right side of the >
StandardException
- Thrown on errorpublic BooleanDataValue lessOrEquals(DataValueDescriptor left, DataValueDescriptor right) throws StandardException
lessOrEquals
in interface DataValueDescriptor
left
- The value on the left side of the <=right
- The value on the right side of the <=
StandardException
- Thrown on errorpublic BooleanDataValue greaterOrEquals(DataValueDescriptor left, DataValueDescriptor right) throws StandardException
greaterOrEquals
in interface DataValueDescriptor
left
- The value on the left side of the >=right
- The value on the right side of the >=
StandardException
- Thrown on errorpublic boolean compare(int op, DataValueDescriptor other, boolean orderedNulls, boolean unknownRV) throws StandardException
DataValueDescriptor
compare
in interface DataValueDescriptor
op
- Orderable.ORDER_OP_EQUALS means do an = comparison.
Orderable.ORDER_OP_LESSTHAN means compare this < other.
Orderable.ORDER_OP_LESSOREQUALS means compare this <= other.other
- The DataValueDescriptor to compare this one to.orderedNulls
- 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.unknownRV
- 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.
StandardException
- Thrown on errorprotected static int flip(int operator)
operator
- The operator to flip.
public DataValueDescriptor coalesce(DataValueDescriptor[] argumentsList, DataValueDescriptor returnValue) throws StandardException
DataValueDescriptor
coalesce
in interface DataValueDescriptor
argumentsList
- The list of the arguments. Function will return the first non-nullable argument if any.returnValue
- The return value is the correct datatype for this function.
The return value of this method is the type of the 2nd parameter.
StandardException
- Thrown on errorDataValueDescriptor.coalesce(org.apache.derby.iapi.types.DataValueDescriptor[], org.apache.derby.iapi.types.DataValueDescriptor)
public BooleanDataValue in(DataValueDescriptor left, DataValueDescriptor[] inList, boolean orderedList) throws StandardException
DataValueDescriptor
in
in interface DataValueDescriptor
left
- The value on the left side of the operatorinList
- The values in the IN listorderedList
- True means that the values in the IN list are ordered,
false means they are not.
StandardException
- Thrown on errorDataValueDescriptor.in(org.apache.derby.iapi.types.DataValueDescriptor, org.apache.derby.iapi.types.DataValueDescriptor[], boolean)
public boolean equals(java.lang.Object other)
public void setValue(java.io.InputStream theStream, int streamLength) throws StandardException
DataValueDescriptor
setValue
in interface DataValueDescriptor
theStream
- stream of correctly formatted datastreamLength
- logical length of the stream's value in units of this type (e.g. chars for string types).
StandardException
public void checkHostVariable(int declaredLength) throws StandardException
checkHostVariable
in interface DataValueDescriptor
StandardException
- Variable is too big.protected final StandardException dataTypeConversion(java.lang.String targetType)
protected final StandardException outOfRange()
protected final StandardException invalidFormat()
|
Built on Tue 2006-10-10 19:23:47+0200, from revision exported | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |