Top Description Fields Constructors Methods
org.apache.derby.impl.store.access.heap

public Class HeapRowLocation

extends DataType
implements RowLocation, RefDataValue
Class Inheritance
All Implemented Interfaces
org.apache.derby.iapi.types.RefDataValue, 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, org.apache.derby.iapi.types.RowLocation
Imports
org.apache.derby.shared.common.error.StandardException, org.apache.derby.iapi.services.cache.ClassSize, org.apache.derby.iapi.services.io.ArrayInputStream, .CompressedNumber, .StoredFormatIds, org.apache.derby.shared.common.sanity.SanityManager, org.apache.derby.iapi.store.raw.RecordHandle, .ContainerHandle, org.apache.derby.iapi.types.DataType, .DataValueDescriptor, .RefDataValue, .RowLocation, java.io.ObjectOutput, .ObjectInput, .IOException

A heap row location represents the location of a row in the heap.

It is implementad as a wrapper around a raw store record handle.

Field Summary

Modifier and TypeField and Description
private static final int
private long
pageno

The HeapRowLocation simply maintains a raw store record handle.

private int
private static final int
private RecordHandle

Constructor Summary

AccessConstructor and Description
pack-priv
public
private

Method Summary

Modifier and TypeMethod and Description
public DataValueDescriptor
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
)

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

Clone this DataValueDescriptor.

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
)

Overrides org.apache.derby.iapi.types.DataType.compare.

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

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

public int
compare(DataValueDescriptor
The Orderable to compare this one to.
other
)

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

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

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

Overrides org.apache.derby.iapi.types.DataType.equals.

Implement value equality.

public int
estimateMemoryUsage()

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

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

public int
getLength()

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

Gets the length of the data value.

public DataValueDescriptor
getNewNull()

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

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

public Object
getObject()

Overrides org.apache.derby.iapi.types.DataType.getObject.

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

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

public RecordHandle
public String
getString()

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

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

public int
public String
getTypeName()

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

Get the SQL name of the datatype

public int
hashCode()

Overrides java.lang.Object.hashCode.

Return a hashcode based on value.

public boolean
isNull()

Implements org.apache.derby.iapi.services.io.Storable.isNull.

Return whether the value is null or not.

public void
readExternal(ObjectInput
the stream to read data from in order to restore the object
in
)

Implements java.io.Externalizable.readExternal.

The object implements the readExternal method to restore its contents by calling the methods of DataInput for primitive types and readObject for objects, strings and arrays.

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

Overrides org.apache.derby.iapi.types.DataType.readExternalFromArray.

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

Read the DataValueDescriptor from the stream.

public DataValueDescriptor

Returns:

this object reset to its initial state
recycle
()

Overrides org.apache.derby.iapi.types.DataType.recycle.

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

Recycle this HeapRowLocation object.

public void
restoreToNull()

Implements org.apache.derby.iapi.services.io.Storable.restoreToNull.

Restore this object to its (SQL)null value.

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

Overrides org.apache.derby.iapi.types.DataType.setFrom.

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

public void
setValue(RowLocation
Contains the boolean value to set this RefDataValue to. Null means set this RefDataValue to null.
rowLocation
)

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

Set the value of this RefDataValue.

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
)

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

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

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

public void
writeExternal(ObjectOutput
the stream to write the object to
out
)

Implements java.io.Externalizable.writeExternal.

The object implements the writeExternal method to save its contents by calling the methods of DataOutput for its primitive values or calling the writeObject method of ObjectOutput for objects, strings, and arrays.

Inherited from org.apache.derby.iapi.types.DataType:
checkHostVariablecloneHoldercoalescecomparecomparecompareTodataTypeConversionequalsflipgetBooleangetBytegetBytesgetDategetDoublegetFloatgetIntgetLonggetShortgetStreamgetTimegetTimestampgetTraceStringgreaterOrEqualsgreaterThanhasStreamininvalidFormatisNotNullisNullOplessOrEqualslessThannormalizenotEqualsoutOfRangesetBigDecimalsetIntosetIntosetObjectForCastsetToNullsetValuesetValuesetValuesetValuesetValuesetValuesetValuesetValuesetValuesetValuesetValuesetValuesetValuesetValuesetValuesetValuesetValuesetValuesetValuesetValuethrowLangSetMismatchtypePrecedencetypeToBigDecimal

Field Detail

BASE_MEMORY_USAGEback to summary
private static final int BASE_MEMORY_USAGE
pagenoback to summary
private long pageno

The HeapRowLocation simply maintains a raw store record handle.

recidback to summary
private int recid
RECORD_HANDLE_MEMORY_USAGEback to summary
private static final int RECORD_HANDLE_MEMORY_USAGE
rhback to summary
private RecordHandle rh

Constructor Detail

HeapRowLocationback to summary
pack-priv HeapRowLocation(RecordHandle rh)
HeapRowLocationback to summary
public HeapRowLocation()
HeapRowLocationback to summary
private HeapRowLocation(HeapRowLocation other)

Method Detail

cloneValueback to summary
public DataValueDescriptor cloneValue(boolean forceMaterialization)

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

Doc from org.apache.derby.iapi.types.DataValueDescriptor.cloneValue.

Clone this DataValueDescriptor. Results in a new object that has the same value as this but can be modified independently.

Even though the objects can be modified independently regardless of the value of forceMaterialization, both the clone and the original may be dependent on the store state if forceMaterialization is set to false. An example is if you need to access the value you just read using cloneValue after the current transaction has ended, or after the source result set has been closed.

Parameters
forceMaterialization: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

Returns:DataValueDescriptor

A clone of the DataValueDescriptor with the same initial value as this.

compareback to summary
public boolean compare(int op, DataValueDescriptor other, boolean orderedNulls, boolean unknownRV)

Overrides org.apache.derby.iapi.types.DataType.compare.

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

Doc from org.apache.derby.iapi.types.DataValueDescriptor.compare.

Compare this Orderable with a given Orderable for the purpose of qualification and sorting. The caller gets to determine how nulls should be treated - they can either be ordered values or unknown values.

Parameters
op: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.

other:DataValueDescriptor

The DataValueDescriptor to compare this one to.

orderedNulls: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.

unknownRV: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.

Returns:boolean

true if the comparison is true (duh!)

compareback to summary
public int compare(DataValueDescriptor other)

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

Doc from org.apache.derby.iapi.types.DataValueDescriptor.compare.

Compare this Orderable with a given Orderable for the purpose of index positioning. This method treats nulls as ordered values - that is, it treats SQL null as equal to null and greater than all other values.

Parameters
other:DataValueDescriptor

The Orderable to compare this one to.

Returns:int

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

equalsback to summary
public boolean equals(Object ref)

Overrides org.apache.derby.iapi.types.DataType.equals.

Implement value equality.
MT - Thread safe

Parameters
ref:Object

Doc from java.lang.Object.equals.

the reference object with which to compare.

Returns:boolean

Doc from java.lang.Object.equals.

true if this object is the same as the obj argument; false otherwise.

estimateMemoryUsageback to summary
public int estimateMemoryUsage()

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

Doc from org.apache.derby.iapi.types.DataValueDescriptor.estimateMemoryUsage.

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

Returns:int

the estimated memory usage

getLengthback to summary
public int getLength()

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

Doc from org.apache.derby.iapi.types.DataValueDescriptor.getLength.

Gets the length of the data value. The meaning of this is implementation-dependent. For string types, it is the number of characters in the string. For numeric types, it is the number of bytes used to store the number. This is the actual length of this value, not the length of the type it was defined as. For example, a VARCHAR value may be shorter than the declared VARCHAR (maximum) length.

Returns:int

The length of the data value

getNewNullback to summary
public DataValueDescriptor getNewNull()

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

Doc from org.apache.derby.iapi.types.DataValueDescriptor.getNewNull.

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

getObjectback to summary
public Object getObject()

Overrides org.apache.derby.iapi.types.DataType.getObject.

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

Doc from org.apache.derby.iapi.types.DataValueDescriptor.getObject.

Gets the value in the data value descriptor as a Java Object. The type of the Object will be the Java object type corresponding to the data value's SQL type. JDBC defines a mapping between Java object types and SQL types - we will allow that to be extended through user type definitions. Throws an exception if the data value is not an object (yeah, right).

Returns:Object

The data value as an Object.

getRecordHandleback to summary
public RecordHandle getRecordHandle(ContainerHandle ch) throws StandardException
getStringback to summary
public String getString()

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

Doc from org.apache.derby.iapi.types.DataValueDescriptor.getString.

Gets the value in the data value descriptor as a String. Throws an exception if the data value is not a string.

Returns:String

The data value as a String.

getTypeFormatIdback to summary
public int getTypeFormatId()

Implements org.apache.derby.iapi.services.io.TypedFormat.getTypeFormatId.

Return my format identifier.

Returns:int

Doc from org.apache.derby.iapi.services.io.TypedFormat.getTypeFormatId.

The identifier. (A UUID stuffed in an array of 16 bytes).

See Also
org.apache.derby.iapi.services.io.TypedFormat#getTypeFormatId
getTypeNameback to summary
public String getTypeName()

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

Doc from org.apache.derby.iapi.types.DataValueDescriptor.getTypeName.

Get the SQL name of the datatype

Returns:String

The SQL name of the datatype

hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Return a hashcode based on value.
MT - thread safe

Returns:int

Doc from java.lang.Object.hashCode.

a hash code value for this object

isNullback to summary
public boolean isNull()

Implements org.apache.derby.iapi.services.io.Storable.isNull.

Doc from org.apache.derby.iapi.services.io.Storable.isNull.

Return whether the value is null or not.

Returns:boolean

true if the value is null and false otherwise.

readExternalback to summary
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException

Implements java.io.Externalizable.readExternal.

Doc from java.io.Externalizable.readExternal.

The object implements the readExternal method to restore its contents by calling the methods of DataInput for primitive types and readObject for objects, strings and arrays. The readExternal method must read the values in the same sequence and with the same types as were written by writeExternal.

Parameters
in:ObjectInput

the stream to read data from in order to restore the object

Exceptions
IOException:
if I/O errors occur
ClassNotFoundException:
A class needed to read the stored form of this object could not be found.
See Also
java.io.Externalizable#readExternal
readExternalFromArrayback to summary
public void readExternalFromArray(ArrayInputStream in) throws IOException, ClassNotFoundException

Overrides org.apache.derby.iapi.types.DataType.readExternalFromArray.

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

Doc from org.apache.derby.iapi.types.DataValueDescriptor.readExternalFromArray.

Read the DataValueDescriptor from the stream.

Initialize 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().

Parameters
in:ArrayInputStream

The array stream positioned at the beginning of the byte stream to read from.

Exceptions
IOException:
Usual error is if you try to read past limit on the stream.
ClassNotFoundException:
If a necessary class can not be found while reading the object from the stream.
recycleback to summary
public DataValueDescriptor recycle()

Overrides org.apache.derby.iapi.types.DataType.recycle.

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

Recycle this HeapRowLocation object.

Returns:DataValueDescriptor

this object reset to its initial state

restoreToNullback to summary
public void restoreToNull()

Implements org.apache.derby.iapi.services.io.Storable.restoreToNull.

Doc from org.apache.derby.iapi.services.io.Storable.restoreToNull.

Restore this object to its (SQL)null value.

setFromback to summary
pack-priv void setFrom(RecordHandle rh)
setFromback to summary
protected void setFrom(DataValueDescriptor theValue)

Overrides org.apache.derby.iapi.types.DataType.setFrom.

Doc from org.apache.derby.iapi.types.DataType.setFrom.

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

Parameters
theValue:DataValueDescriptor

The DataValueDescriptor that holds the value to which we want to set this DataValueDescriptor's value.

setValueback to summary
public void setValue(RowLocation rowLocation)

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

Doc from org.apache.derby.iapi.types.RefDataValue.setValue.

Set the value of this RefDataValue.

Parameters
rowLocation:RowLocation

Contains the boolean value to set this RefDataValue to. Null means set this RefDataValue to null.

setValueFromResultSetback to summary
public void setValueFromResultSet(ResultSet resultSet, int colNumber, boolean isNullable)

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

Doc from org.apache.derby.iapi.types.DataValueDescriptor.setValueFromResultSet.

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

Parameters
resultSet:ResultSet

The specified ResultSet.

colNumber:int

The 1-based column # into the resultSet.

isNullable:boolean

Whether or not the column is nullable (No need to call wasNull() if not)

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

writeExternalback to summary
public void writeExternal(ObjectOutput out) throws IOException

Implements java.io.Externalizable.writeExternal.

Doc from java.io.Externalizable.writeExternal.

The object implements the writeExternal method to save its contents by calling the methods of DataOutput for its primitive values or calling the writeObject method of ObjectOutput for objects, strings, and arrays.

Parameters
out:ObjectOutput

the stream to write the object to

Exceptions
IOException:
Includes any I/O exceptions that may occur