public class TempTableResultSet extends TableResultSet
temp-table DMO
. The data is read fully in memory and sent to the remote
side row by row; the DMO metadata is used to extract the properties and their settings (type
and extent). Note that each send row will have the values in the same order as the DMO's
properties.
The TempTableResultSet(Temporary, boolean, boolean, boolean)
must not be used outside
of the P2J runtime, as it is dependent on the P2J's persistence frame to read the DMO's data.
From Java code, use the TempTableResultSet()
to instantiate a new, empty, result set;
this will be used as a container to transport back the result and the metadat.
Modifier and Type | Field and Description |
---|---|
private Temporary |
dmo
The DMO associated with the temp table; this will be used to extract the DMO metadata and
the table data.
|
private java.util.Iterator<PropertyDefinition> |
propIter
Iterator over the DMO's properties.
|
private java.util.Iterator<java.lang.Object[]> |
rowIter
Iterator over the temp-table's data.
|
private java.util.Iterator<java.lang.Object[]> |
rowMetaIter
Iterator over the temp-table rows' meta information.
|
append, input, output, structureName
Constructor and Description |
---|
TempTableResultSet()
Default c'tor, explicitly added to allow instances of this class to be created on
deserialization.
|
TempTableResultSet(boolean output)
Create a new instance of this result set, when it acts as a container for an
OUTPUT parameter received from the remote side.
|
TempTableResultSet(boolean output,
boolean append)
Create a new instance of this result set, when it acts as a container for an
OUTPUT parameter received from the remote side.
|
TempTableResultSet(Temporary dmo,
boolean input,
boolean output,
boolean append)
Create a new instance of this result set and associate it with the metadata and data for
the specified temp DMO.
|
TempTableResultSet(Temporary dmo,
boolean input,
boolean output,
boolean append,
boolean copyRows)
Create a new instance of this result set and associate it with the metadata and data for
the specified temp DMO.
|
Modifier and Type | Method and Description |
---|---|
void |
clearRows()
Delete row data.
|
boolean |
hasMoreProperties()
Check if there are more properties for this DMO.
|
boolean |
hasMoreRows()
Check if there are more rows for this table.
|
private void |
init(boolean copyRows)
Initialize this result set, by reading the entire temp-table in memory.
|
PropertyDefinition |
nextProperty()
Returns the next property of this DMO.
|
java.lang.Object[] |
nextRow()
Returns the data for the next row.
|
java.lang.Object[] |
nextRowMeta()
Used in conjunction with
hasMoreRows() , it provides a mechanism for subclasses to
send the row meta information in an iterator-like form. |
void |
setProperties(java.util.List<PropertyDefinition> properties)
Set the metadata sent by a remote side, after the remote appserver call.
|
void |
setRows(java.util.List<java.lang.Object[]> rows)
Set the data sent by a remote side, after the remote appserver call.
|
void |
setRowsMeta(java.util.List<java.lang.Object[]> rowsMeta)
Set the meta row information sent by a remote side, after the remote appserver call.
|
asResultSet, getProperties, getRows, getRowsMeta
getStructureName, isAppend, isInput, isOutput, setStructureName
private Temporary dmo
private java.util.Iterator<PropertyDefinition> propIter
private java.util.Iterator<java.lang.Object[]> rowIter
private java.util.Iterator<java.lang.Object[]> rowMetaIter
public TempTableResultSet()
public TempTableResultSet(boolean output)
output
- Flag indicating this table is sent in OUTPUT mode. Must always be set to
true
.java.lang.IllegalStateException
- If the output
parameter is not set to true
.public TempTableResultSet(boolean output, boolean append)
output
- Flag indicating this table is sent in OUTPUT mode. Must always be set to
true
.append
- Flag indicating this table is sent in APPEND mode.java.lang.IllegalStateException
- If the output
parameter is not set to true
.public TempTableResultSet(Temporary dmo, boolean input, boolean output, boolean append)
dmo
- DMO instance returned by a previous call to TemporaryBuffer.define(java.lang.Class<T>, java.lang.String, boolean)
on the
source temporary buffer.input
- Flag indicating this table is sent in INPUT or INPUT-OUTPUT mode.output
- Flag indicating this table is sent in OUTPUT or INPUT-OUTPUT mode.append
- Flag indicating this table is sent in APPEND mode.java.lang.ClassNotFoundException
- If the type of a property can not be resolved to a class.public TempTableResultSet(Temporary dmo, boolean input, boolean output, boolean append, boolean copyRows)
dmo
- DMO instance returned by a previous call to TemporaryBuffer.define(java.lang.Class<T>, java.lang.String, boolean)
on the
source temporary buffer.input
- Flag indicating this table is sent in INPUT or INPUT-OUTPUT mode.output
- Flag indicating this table is sent in OUTPUT or INPUT-OUTPUT mode.append
- Flag indicating this table is sent in APPEND mode.copyRows
- true
> to transfer rows in INPUT direction. false
> to transfer only
table definitions.public void setRows(java.util.List<java.lang.Object[]> rows)
setRows
in class TableResultSet
rows
- The data sent by the remote side.public void setRowsMeta(java.util.List<java.lang.Object[]> rowsMeta)
setRowsMeta
in class TableResultSet
rowsMeta
- The meta information sent by the remote side.public void setProperties(java.util.List<PropertyDefinition> properties)
setProperties
in class TableResultSet
properties
- The metadata sent by the remote side.public boolean hasMoreProperties()
WARNING: this allows only one iteration over the properties and is for internal usage
only. Use TableResultSet.asResultSet()
and the associated ResultSetMetaData
instead.
hasMoreProperties
in class TableResultSet
public PropertyDefinition nextProperty()
WARNING: this allows only one iteration over the properties and is for internal usage
only. Use TableResultSet.asResultSet()
and the associated ResultSetMetaData
instead.
nextProperty
in class TableResultSet
public boolean hasMoreRows()
WARNING: this allows only one iteration over the properties and is for internal usage
only. Use TableResultSet.asResultSet()
instead.
hasMoreRows
in class TableResultSet
public java.lang.Object[] nextRow()
WARNING: this allows only one iteration over the properties and is for internal usage
only. Use TableResultSet.asResultSet()
instead.
nextRow
in class TableResultSet
public java.lang.Object[] nextRowMeta()
hasMoreRows()
, it provides a mechanism for subclasses to
send the row meta information in an iterator-like form.
Override this method so that when hasMoreRows()
returns true
, this will
return the next row in the table.
WARNING: this allows only one iteration over the properties and is for internal usage
only. Use TableResultSet.asResultSet()
and instead.
nextRowMeta
in class TableResultSet
null
.public void clearRows()
clearRows
in class TableResultSet
private void init(boolean copyRows)
copyRows
- true
> to transfer rows in INPUT direction. false
> to transfer only
table definitions.
TODO: improve this (i.e. use an open cursor or some other alternative to not read the data
in memory)java.lang.ClassNotFoundException
- If the type of a property can not be resolved to a class.