|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.derby.iapi.types.DataType
org.apache.derby.iapi.types.NumberDataType
org.apache.derby.iapi.types.SQLTinyint
SQLTinyint satisfies the DataValueDescriptor interfaces (i.e., OrderableDataType). It implements a tinyint column, e.g. for storing a column value; it can be specified when constructed to not allow nulls. Nullability cannot be changed after construction, as it affects the storage size and mechanism.
Because OrderableDataType is a subtype of ValueColumn, SQLTinyint can play a role in either a ValueColumn/Row or a OrderableDataType/Row, interchangeably.
We assume the store has a flag for nullness of the value, and simply return a 0-length array for the stored form when the value is null.
| Field Summary | |
private static int |
BASE_MEMORY_USAGE
|
private boolean |
isnull
|
(package private) static int |
TINYINT_LENGTH
|
private byte |
value
|
| Fields inherited from class org.apache.derby.iapi.types.NumberDataType |
MAXLONG_PLUS_ONE, MINLONG_MINUS_ONE, ZERO_DECIMAL |
| Fields inherited from interface org.apache.derby.iapi.types.NumberDataValue |
MAX_DECIMAL_PRECISION_SCALE, MIN_DECIMAL_DIVIDE_SCALE |
| 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 | |
SQLTinyint()
No-arg constructor, required by Formattable. |
|
SQLTinyint(byte val)
|
|
SQLTinyint(byte val,
boolean isnull)
|
|
| Method Summary | |
BooleanDataValue |
equals(DataValueDescriptor left,
DataValueDescriptor right)
The = operator as called from the language module, as opposed to the storage module. |
int |
estimateMemoryUsage()
Estimate the memory usage in bytes of the data value and the overhead of the class. |
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. |
DataValueDescriptor |
getClone()
Clone this DataValueDescriptor. |
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 an int. |
int |
getLength()
Gets the length of the data value. |
long |
getLong()
Gets the value in the data value descriptor as a long. |
DataValueDescriptor |
getNewNull()
Get a new null value of the same type as this data value. |
java.lang.Object |
getObject()
Gets the value in the data value descriptor as a Java Object. |
short |
getShort()
Gets the value in the data value descriptor as a short. |
java.lang.String |
getString()
Gets the value in the data value descriptor as a String. |
int |
getTypeFormatId()
Return my format identifier. |
java.lang.String |
getTypeName()
Get the SQL name of the datatype |
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. |
int |
hashCode()
|
protected boolean |
isNegative()
This method implements the isNegative method. |
boolean |
isNull()
Return whether the value is null or not. |
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. |
NumberDataValue |
minus(NumberDataValue result)
This method implements the unary minus operator for tinyint. |
NumberDataValue |
mod(NumberDataValue dividend,
NumberDataValue divisor,
NumberDataValue result)
mod(tinyint, tinyint) |
BooleanDataValue |
notEquals(DataValueDescriptor left,
DataValueDescriptor right)
The <> operator as called from the language module, as opposed to the storage module. |
void |
readExternal(java.io.ObjectInput in)
|
void |
readExternalFromArray(ArrayInputStream in)
Read the DataValueDescriptor from the stream. |
void |
restoreToNull()
Restore this object to its (SQL)null value. |
protected void |
setFrom(DataValueDescriptor theValue)
|
void |
setInto(java.sql.PreparedStatement ps,
int position)
Set the 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 |
setValue(boolean theValue)
Set the value. |
void |
setValue(byte theValue)
Common code to handle converting a byte to this value by using the int to this value conversion. |
void |
setValue(double theValue)
Set the value of this DataValueDescriptor to the given double value |
void |
setValue(float theValue)
Set the value of this DataValueDescriptor to the given double value |
void |
setValue(int theValue)
Set the value of this DataValueDescriptor to the given int value |
void |
setValue(long theValue)
Set the value of this DataValueDescriptor to the given long value |
void |
setValue(java.lang.Object theValue)
Set the value of this DataValueDescriptor to the given value |
void |
setValue(short theValue)
Common code to handle converting a short to this value by using the int to this value conversion. |
void |
setValue(java.lang.String theValue)
Set the value of this DataValueDescriptor. |
void |
setValueFromResultSet(java.sql.ResultSet resultSet,
int colNumber,
boolean isNullable)
Set the value based on the value for the specified DataValueDescriptor from the specified ResultSet. |
NumberDataValue |
times(NumberDataValue left,
NumberDataValue right,
NumberDataValue result)
This method implements the * operator for "tinyint * tinyint". |
java.lang.String |
toString()
|
protected int |
typeCompare(DataValueDescriptor arg)
Compare this (not null) to a non-null value. |
int |
typePrecedence()
Each built-in type in JSQL has a precedence. |
void |
writeExternal(java.io.ObjectOutput out)
|
| Methods inherited from class org.apache.derby.iapi.types.NumberDataType |
absolute, compare, compare, divide, divide, getDecimalValuePrecision, getDecimalValueScale, minus, normalizeDOUBLE, normalizeREAL, normalizeREAL, objectNull, plus, setBigDecimal, setValue, sqrt, typeToBigDecimal |
| Methods inherited from class org.apache.derby.iapi.types.DataType |
checkHostVariable, cloneObject, coalesce, dataTypeConversion, equals, flip, genericSetObject, getBytes, getDate, getNationalString, getStream, getTime, getTimestamp, in, invalidFormat, isNotNull, isNullOp, normalize, outOfRange, setObjectForCast, setToNull, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, throwLangSetMismatch, throwLangSetMismatch |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.apache.derby.iapi.types.DataValueDescriptor |
checkHostVariable, coalesce, getBytes, getDate, getStream, getTime, getTimestamp, in, isNotNull, isNullOp, normalize, setObjectForCast, setToNull, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue |
| Field Detail |
static final int TINYINT_LENGTH
private byte value
private boolean isnull
private static final int BASE_MEMORY_USAGE
| Constructor Detail |
public SQLTinyint()
public SQLTinyint(byte val)
public SQLTinyint(byte val,
boolean isnull)
| Method Detail |
public int estimateMemoryUsage()
DataValueDescriptor
public int getInt()
DataValueDescriptor
getInt in interface DataValueDescriptorgetInt in class DataTypeDataValueDescriptor.getInt()public byte getByte()
DataValueDescriptor
getByte in interface DataValueDescriptorgetByte in class DataTypeDataValueDescriptor.getByte()public short getShort()
DataValueDescriptor
getShort in interface DataValueDescriptorgetShort in class DataTypeDataValueDescriptor.getShort()public long getLong()
DataValueDescriptor
getLong in interface DataValueDescriptorgetLong in class DataTypeDataValueDescriptor.getLong()public float getFloat()
DataValueDescriptor
getFloat in interface DataValueDescriptorgetFloat in class DataTypeDataValueDescriptor.getFloat()public double getDouble()
DataValueDescriptor
getDouble in interface DataValueDescriptorgetDouble in class DataTypeDataValueDescriptor.getDouble()public boolean getBoolean()
DataValueDescriptor
getBoolean in interface DataValueDescriptorgetBoolean in class DataTypeDataValueDescriptor.getBoolean()public java.lang.String getString()
DataValueDescriptor
DataValueDescriptor.getString()public int getLength()
DataValueDescriptor
DataValueDescriptor.getLength()public java.lang.Object getObject()
DataValueDescriptor
getObject in interface DataValueDescriptorgetObject in class DataTypeDataValueDescriptor.getObject()public java.lang.String getTypeName()
DataValueDescriptor
public int getTypeFormatId()
TypedFormat.getTypeFormatId()public boolean isNull()
Storable
Storable.isNull()
public void writeExternal(java.io.ObjectOutput out)
throws java.io.IOException
java.io.IOException
public void readExternal(java.io.ObjectInput in)
throws java.io.IOException
java.io.IOExceptionExternalizable.readExternal(java.io.ObjectInput)
public void readExternalFromArray(ArrayInputStream in)
throws java.io.IOException
DataValueDescriptorInitialize the data value by reading it's values from the ArrayInputStream. This interface is provided as a way to achieve possible performance enhancement when reading an array can be optimized over reading from a generic stream from readExternal().
in - The array stream positioned at the beginning of the
byte stream to read from.
java.io.IOException - Usual error is if you try to read
past limit on the stream.public void restoreToNull()
Storable
Storable.restoreToNull()
protected int typeCompare(DataValueDescriptor arg)
throws StandardException
NumberDataType
typeCompare in class NumberDataTypeStandardException - Thrown on errorpublic DataValueDescriptor getClone()
DataValueDescriptor
DataValueDescriptor.getClone()public DataValueDescriptor getNewNull()
DataValueDescriptor
DataValueDescriptor.getNewNull()
public void setValueFromResultSet(java.sql.ResultSet resultSet,
int colNumber,
boolean isNullable)
throws java.sql.SQLException
DataValueDescriptor
resultSet - The specified ResultSet.colNumber - The 1-based column # into the resultSet.isNullable - Whether or not the column is nullable
(No need to call wasNull() if not)
java.sql.SQLException - Thrown on errorDataValueDescriptor.setValueFromResultSet(java.sql.ResultSet, int, boolean)
public final void setInto(java.sql.PreparedStatement ps,
int position)
throws java.sql.SQLException
setInto in interface DataValueDescriptorsetInto in class DataTypejava.sql.SQLException - Error setting value in PreparedStatement
public final void setInto(java.sql.ResultSet rs,
int position)
throws java.sql.SQLException,
StandardException
setInto in interface DataValueDescriptorsetInto in class DataTypejava.sql.SQLException - thrown by the ResultSet object
StandardException - thrown by me accessing my value.
public void setValue(java.lang.String theValue)
throws StandardException
DataValueDescriptor
setValue in interface DataValueDescriptorsetValue in class DataTypetheValue - The BigDecimal value to set this DataValueDescriptor to
StandardException - thrown if string not acceptedpublic void setValue(byte theValue)
NumberDataType
setValue in interface DataValueDescriptorsetValue in class NumberDataType
public void setValue(short theValue)
throws StandardException
NumberDataType
setValue in interface DataValueDescriptorsetValue in class NumberDataTypeStandardException - if outsideRangeForTinyint
public void setValue(int theValue)
throws StandardException
DataValueDescriptor
setValue in interface DataValueDescriptorsetValue in class DataTypetheValue - The value to set this DataValueDescriptor to
StandardException - if outsideRangeForTinyint
public void setValue(long theValue)
throws StandardException
DataValueDescriptor
setValue in interface DataValueDescriptorsetValue in class DataTypetheValue - The value to set this DataValueDescriptor to
StandardException - if outsideRangeForTinyint
public void setValue(float theValue)
throws StandardException
DataValueDescriptor
setValue in interface DataValueDescriptorsetValue in class DataTypetheValue - The value to set this DataValueDescriptor to
StandardException - Thrown on errorNumberDataValue.setValue(java.lang.Number)
public void setValue(double theValue)
throws StandardException
DataValueDescriptor
setValue in interface DataValueDescriptorsetValue in class DataTypetheValue - The value to set this DataValueDescriptor to
StandardException - Thrown on errorNumberDataValue.setValue(java.lang.Number)public void setValue(boolean theValue)
DataValueDescriptor
setValue in interface DataValueDescriptorsetValue in class DataTypetheValue - Contains the boolean value to set this to
NumberDataValue.setValue(java.lang.Number)
public void setValue(java.lang.Object theValue)
throws StandardException
DataValueDescriptor
setValue in interface DataValueDescriptorsetValue in class DataTypeStandardException - Thrown on errorDataValueDescriptor.setValue(java.lang.Object)
protected void setFrom(DataValueDescriptor theValue)
throws StandardException
setFrom in class DataTypeStandardExceptionpublic int typePrecedence()
DataValueDescriptor
typePrecedence in interface DataValueDescriptortypePrecedence in class DataTypeDataValueDescriptor.typePrecedence()
public BooleanDataValue equals(DataValueDescriptor left,
DataValueDescriptor right)
throws StandardException
equals in interface DataValueDescriptorequals in class DataTypeleft - The value on the left side of the =right - The value on the right side of the =
StandardException - Thrown on error
public BooleanDataValue notEquals(DataValueDescriptor left,
DataValueDescriptor right)
throws StandardException
notEquals in interface DataValueDescriptornotEquals in class DataTypeleft - The value on the left side of the <>right - The value on the right side of the <>
StandardException - Thrown on error
public BooleanDataValue lessThan(DataValueDescriptor left,
DataValueDescriptor right)
throws StandardException
lessThan in interface DataValueDescriptorlessThan in class DataTypeleft - The value on the left side of the <right - The value on the right side of the <
StandardException - Thrown on error
public BooleanDataValue greaterThan(DataValueDescriptor left,
DataValueDescriptor right)
throws StandardException
greaterThan in interface DataValueDescriptorgreaterThan in class DataTypeleft - The value on the left side of the >right - The value on the right side of the >
StandardException - Thrown on error
public BooleanDataValue lessOrEquals(DataValueDescriptor left,
DataValueDescriptor right)
throws StandardException
lessOrEquals in interface DataValueDescriptorlessOrEquals in class DataTypeleft - The value on the left side of the <=right - The value on the right side of the <=
StandardException - Thrown on error
public BooleanDataValue greaterOrEquals(DataValueDescriptor left,
DataValueDescriptor right)
throws StandardException
greaterOrEquals in interface DataValueDescriptorgreaterOrEquals in class DataTypeleft - The value on the left side of the >=right - The value on the right side of the >=
StandardException - Thrown on error
public NumberDataValue times(NumberDataValue left,
NumberDataValue right,
NumberDataValue result)
throws StandardException
left - The first value to be multipliedright - The second value to be multipliedresult - The result of a previous call to this method, null
if not called yet
StandardException - Thrown on error
public NumberDataValue mod(NumberDataValue dividend,
NumberDataValue divisor,
NumberDataValue result)
throws StandardException
mod in interface NumberDataValuemod in class NumberDataTypeStandardException
public NumberDataValue minus(NumberDataValue result)
throws StandardException
result - The result of a previous call to this method, null
if not called yet
StandardException - Thrown on errorprotected boolean isNegative()
isNegative in class NumberDataTypepublic java.lang.String toString()
public int hashCode()
|
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 | |||||||||