Top Description Fields Constructors Methods
org.apache.derby.iapi.sql.execute

public Class ExecRowBuilder

extends Object
implements Formatable
Class Inheritance
All Implemented Interfaces
org.apache.derby.iapi.services.io.Formatable, org.apache.derby.iapi.services.io.TypedFormat, java.io.Externalizable, java.io.Serializable
Imports
java.io.IOException, .ObjectInput, .ObjectOutput, org.apache.derby.shared.common.error.StandardException, org.apache.derby.shared.common.util.ArrayUtil, org.apache.derby.iapi.services.io.Formatable, .StoredFormatIds, org.apache.derby.shared.common.sanity.SanityManager, org.apache.derby.iapi.types.DataTypeDescriptor, .DataValueDescriptor

A class used for storing information on how to build ExecRow instances. Typically created by the compiler and used during execution to produce and reset row templates.

This class must be Formatable so that it can be stored in the database as part of a stored prepared statement generated for trigger actions or metadata queries. The stored format does not need to be stable across different versions, since the stored prepared statements are discarded on upgrade and will never be read by other Derby versions than the one that originally wrote them.

Field Summary

Modifier and TypeField and Description
private int[]
columns

Array of 1-based column numbers for the columns to access.

private int
count

The number of columns to set in the row.

private boolean
indexable

If true, the row should be an ExecIndexRow.

private int
maxColumnNumber

The highest column number in the row.

private Object[]
template

Array of templates used for creating NULL values to put in the row.

Constructor Summary

AccessConstructor and Description
public
ExecRowBuilder(int
the number of columns to initialize in the produced row
size
,
boolean
true if the returned row should be an ExecIndexRow, false otherwise
indexable
)

Create an instance that produces an ExecRow instance of the specified size.

public
ExecRowBuilder()

Public no-arg constructor required by the Formatable interface.

Method Summary

Modifier and TypeMethod and Description
public ExecRow

Returns:

a row initialized with NULL values of the requested types
build
(ExecutionFactory
an execution factory used to create a row
ef
)

Build a new ExecRow instance with the columns specified by the setColumn(int, Object) method initialized to empty (NULL) values.

public int
getTypeFormatId()

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

Get a universally unique identifier for the type of this object.

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
reset(ExecRow
the row to reset
row
)

Reset a row by creating fresh NULL values.

public void
setColumn(int
the column number
column
,
Object
a template from which a NULL value can be created (either a DataValueDescriptor or a DataTypeDescriptor)
columnTemplate
)

Add a template from which a NULL value of the correct type can be created.

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 java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

columnsback to summary
private int[] columns

Array of 1-based column numbers for the columns to access.

countback to summary
private int count

The number of columns to set in the row.

indexableback to summary
private boolean indexable

If true, the row should be an ExecIndexRow.

maxColumnNumberback to summary
private int maxColumnNumber

The highest column number in the row.

templateback to summary
private Object[] template

Array of templates used for creating NULL values to put in the row. The templates are either DataValueDescriptors or DataTypeDescriptors.

Constructor Detail

ExecRowBuilderback to summary
public ExecRowBuilder(int size, boolean indexable)

Create an instance that produces an ExecRow instance of the specified size.

Parameters
size:int

the number of columns to initialize in the produced row

indexable:boolean

true if the returned row should be an ExecIndexRow, false otherwise

ExecRowBuilderback to summary
public ExecRowBuilder()

Public no-arg constructor required by the Formatable interface. Should not be called directly.

Method Detail

buildback to summary
public ExecRow build(ExecutionFactory ef) throws StandardException

Build a new ExecRow instance with the columns specified by the setColumn(int, Object) method initialized to empty (NULL) values.

Parameters
ef:ExecutionFactory

an execution factory used to create a row

Returns:ExecRow

a row initialized with NULL values of the requested types

getTypeFormatIdback to summary
public int getTypeFormatId()

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

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

Get a universally unique identifier for the type of this object.

Returns:int

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

Annotations
@Override
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

Annotations
@Override
Exceptions
IOException:
if I/O errors occur
ClassNotFoundException:
If the class for an object being restored cannot be found.
resetback to summary
public void reset(ExecRow row) throws StandardException

Reset a row by creating fresh NULL values.

Parameters
row:ExecRow

the row to reset

setColumnback to summary
public void setColumn(int column, Object columnTemplate)

Add a template from which a NULL value of the correct type can be created. It should either be a DataValueDescriptor or a DataTypeDescriptor.

Parameters
column:int

the column number

columnTemplate:Object

a template from which a NULL value can be created (either a DataValueDescriptor or a DataTypeDescriptor)

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

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