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

public Class StorableFormatId

extends DataType
Class Inheritance
Imports
org.apache.derby.shared.common.reference.SQLState, org.apache.derby.iapi.services.io.FormatIdUtil, .StoredFormatIds, org.apache.derby.shared.common.sanity.SanityManager, org.apache.derby.shared.common.error.StandardException, org.apache.derby.iapi.services.cache.ClassSize, org.apache.derby.iapi.types.DataType, .DataValueDescriptor, java.sql.ResultSet, .SQLException, java.io.ObjectOutput, .ObjectInput, .IOException

Field Summary

Modifier and TypeField and Description
private static final int
private int

Constructor Summary

AccessConstructor and Description
public
public
StorableFormatId(int value)

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

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

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

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

Returns:

The length of the data value
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

Returns:

The data value as an 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 String

Returns:

The data value as a 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

Returns:

The SQL name of the datatype
getTypeName
()

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

Get the SQL name of the datatype

public int
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
restoreToNull()

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

Restore this object to its (SQL)null value.

protected void
setFrom(DataValueDescriptor
The Date value to set this DataValueDescriptor to
theValue
)

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

Set the value of this DataValueDescriptor from another.

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

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

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
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 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:
checkHostVariablecloneHoldercoalescecomparecomparecomparecompareTodataTypeConversionequalsequalsflipgetBooleangetBytegetBytesgetDategetDoublegetFloatgetIntgetLonggetShortgetStreamgetTimegetTimestampgetTraceStringgreaterOrEqualsgreaterThanhasStreamininvalidFormatisNotNullisNullOplessOrEqualslessThannormalizenotEqualsoutOfRangereadExternalFromArrayrecyclesetBigDecimalsetIntosetIntosetObjectForCastsetToNullsetValuesetValuesetValuesetValuesetValuesetValuesetValuesetValuesetValuesetValuesetValuesetValuesetValuesetValuesetValuesetValuesetValuesetValuesetValuethrowLangSetMismatchtypePrecedencetypeToBigDecimal

Field Detail

BASE_MEMORY_USAGEback to summary
private static final int BASE_MEMORY_USAGE
format_idback to summary
private int format_id

Constructor Detail

StorableFormatIdback to summary
public StorableFormatId()
StorableFormatIdback to summary
public StorableFormatId(int value)

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.

See Also
org.apache.derby.iapi.types.DataValueDescriptor#cloneValue
compareback to summary
public int compare(DataValueDescriptor other) throws StandardException

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

Exceptions
StandardException:
Thrown on error
See Also
DataValueDescriptor#compare
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() throws StandardException

Implements 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

Exceptions
StandardException:
On error
See Also
org.apache.derby.iapi.types.DataValueDescriptor#getLength
getNewNullback to summary
public DataValueDescriptor getNewNull()

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

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

See Also
org.apache.derby.iapi.types.DataValueDescriptor#getNewNull
getObjectback to summary
public Object getObject() throws StandardException

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

Exceptions
StandardException:
Thrown on error
See Also
org.apache.derby.iapi.types.DataValueDescriptor#getObject
getStringback to summary
public String getString() throws StandardException

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

Exceptions
StandardException:
Thrown on error
See Also
org.apache.derby.iapi.types.DataValueDescriptor#getString
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.

Get the SQL name of the datatype

Returns:String

The SQL name of the datatype

See Also
org.apache.derby.iapi.types.DataValueDescriptor#getTypeName
getValueback to summary
public int getValue()
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

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
See Also
java.io.Externalizable#readExternal
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
protected void setFrom(DataValueDescriptor theValue) throws StandardException

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

Set the value of this DataValueDescriptor from another.

Parameters
theValue:DataValueDescriptor

The Date value to set this DataValueDescriptor to

See Also
org.apache.derby.iapi.types.DataValueDescriptor#setValue
setValueback to summary
public void setValue(int input_value)

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

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

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

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

Parameters
input_value:int

The value to set this DataValueDescriptor to

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

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

Exceptions
StandardException:
Thrown on error
SQLException:
Error accessing the result set
See Also
org.apache.derby.iapi.types.DataValueDescriptor#setValueFromResultSet
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