Class ExecRowBuilder
- java.lang.Object
-
- org.apache.derby.iapi.sql.execute.ExecRowBuilder
-
- All Implemented Interfaces:
java.io.Externalizable,java.io.Serializable,Formatable,TypedFormat
public class ExecRowBuilder extends java.lang.Object implements Formatable
A class used for storing information on how to build
ExecRowinstances. Typically created by the compiler and used during execution to produce and reset row templates.This class must be
Formatableso 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.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private int[]columnsArray of 1-based column numbers for the columns to access.private intcountThe number of columns to set in the row.private booleanindexableIf true, the row should be anExecIndexRow.private intmaxColumnNumberThe highest column number in the row.private java.lang.Object[]templateArray of templates used for creating NULL values to put in the row.
-
Constructor Summary
Constructors Constructor Description ExecRowBuilder()Public no-arg constructor required by theFormatableinterface.ExecRowBuilder(int size, boolean indexable)Create an instance that produces anExecRowinstance of the specified size.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ExecRowbuild(ExecutionFactory ef)Build a newExecRowinstance with the columns specified by thesetColumn(int, Object)method initialized to empty (NULL) values.intgetTypeFormatId()Get a universally unique identifier for the type of this object.voidreadExternal(java.io.ObjectInput in)voidreset(ExecRow row)Reset a row by creating fresh NULL values.voidsetColumn(int column, java.lang.Object columnTemplate)Add a template from which a NULL value of the correct type can be created.voidwriteExternal(java.io.ObjectOutput out)
-
-
-
Field Detail
-
indexable
private boolean indexable
If true, the row should be anExecIndexRow.
-
template
private java.lang.Object[] template
Array of templates used for creating NULL values to put in the row. The templates are eitherDataValueDescriptors orDataTypeDescriptors.
-
columns
private int[] columns
Array of 1-based column numbers for the columns to access.
-
count
private int count
The number of columns to set in the row.
-
maxColumnNumber
private int maxColumnNumber
The highest column number in the row.
-
-
Constructor Detail
-
ExecRowBuilder
public ExecRowBuilder(int size, boolean indexable)Create an instance that produces anExecRowinstance of the specified size.- Parameters:
size- the number of columns to initialize in the produced rowindexable-trueif the returned row should be anExecIndexRow,falseotherwise
-
ExecRowBuilder
public ExecRowBuilder()
Public no-arg constructor required by theFormatableinterface. Should not be called directly.
-
-
Method Detail
-
setColumn
public void setColumn(int column, java.lang.Object columnTemplate)Add a template from which a NULL value of the correct type can be created. It should either be aDataValueDescriptoror aDataTypeDescriptor.- Parameters:
column- the column numbercolumnTemplate- a template from which a NULL value can be created (either aDataValueDescriptoror aDataTypeDescriptor)
-
build
public ExecRow build(ExecutionFactory ef) throws StandardException
Build a newExecRowinstance with the columns specified by thesetColumn(int, Object)method initialized to empty (NULL) values.- Parameters:
ef- an execution factory used to create a row- Returns:
- a row initialized with NULL values of the requested types
- Throws:
StandardException
-
reset
public void reset(ExecRow row) throws StandardException
Reset a row by creating fresh NULL values.- Parameters:
row- the row to reset- Throws:
StandardException
-
writeExternal
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException- Specified by:
writeExternalin interfacejava.io.Externalizable- Throws:
java.io.IOException
-
readExternal
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException- Specified by:
readExternalin interfacejava.io.Externalizable- Throws:
java.io.IOExceptionjava.lang.ClassNotFoundException
-
getTypeFormatId
public int getTypeFormatId()
Description copied from interface:TypedFormatGet a universally unique identifier for the type of this object.- Specified by:
getTypeFormatIdin interfaceTypedFormat- Returns:
- The identifier. (A UUID stuffed in an array of 16 bytes).
-
-