Top Fields Constructors Methods
org.apache.derby.impl.sql.execute

public abstract Class DMLWriteGeneratedColumnsResultSet

extends DMLWriteResultSet
Class Inheritance
Known Direct Subclasses
org.apache.derby.impl.sql.execute.InsertResultSet, org.apache.derby.impl.sql.execute.UpdateResultSet
Imports
java.util.Arrays, .HashMap, .Properties, org.apache.derby.shared.common.error.StandardException, org.apache.derby.shared.common.reference.SQLState, org.apache.derby.iapi.sql.Activation, .ResultDescription, .ResultSet, org.apache.derby.iapi.sql.dictionary.ColumnDescriptor, .TableDescriptor, org.apache.derby.iapi.sql.execute.ConstantAction, .ExecRow, .NoPutResultSet, .RowChanger, org.apache.derby.iapi.types.DataValueDescriptor, .NumberDataValue, org.apache.derby.shared.common.sanity.SanityManager, org.apache.derby.catalog.UUID

Field Summary

Modifier and TypeField and Description
protected DataValueDescriptor[]
aiCache

keeps track of autoincrement values that are generated by getSetAutoincrementValues.

protected int[]
protected ResultSet
protected TemporaryRowHolderImpl
protected boolean
autoincrementGenerated

If set to true, implies that Derby has generated autoincrement values for this (rep)resultset.

protected String
protected long
protected boolean
protected NoPutResultSet
Inherited from org.apache.derby.impl.sql.execute.DMLWriteResultSet:
baseRowReadMapcachedDestinationsconstantActionheapDCOCIindexDCOCIsresultDescriptionrowCountstreamStorableHeapColIds

Constructor Summary

AccessConstructor and Description
pack-priv
DMLWriteGeneratedColumnsResultSet(Activation
an activation
activation
)

Constructor

pack-priv

Method Summary

Modifier and TypeMethod and Description
protected void
firstExecuteSpecialHandlingAutoGen(boolean firstExecute, RowChanger rowChanger, UUID targetUUID)

private int[]
generatedColumnPositionsArray(UUID targetUUID)

If user didn't provide columns list for auto-generated columns, then only include columns with auto-generated values in the resultset.

public ResultSet
protected ExecRow
getCompactRow(ExecRow inputRow, int[] columnIndexes)

Take the input row and return a new compact ExecRow using the column positions provided in columnIndexes.

public NumberDataValue
getSetAutoincrementValue(int
position of the column in the table (1-based)
columnPosition
,
long
amount of increment.
increment
)

getSetAutoincrementValue will get the autoincrement value of the columnPosition specified for the target table.

public void
saveAIcacheInformation(String schemaName, String tableName, String[] columnNames)

private int[]
uniqueColumnPositionArray(int[] columnIndexes, UUID targetUUID)

Remove duplicate columns from the array.

private boolean
verifyAutoGenColumn(ColumnDescriptor cd)

Check that the received ColumnDescriptor corresponds to a column for which it is possible to fetch auto-generated keys.

private void
verifyAutoGeneratedColumnsIndexes(int[] columnIndexes, UUID targetUUID)

Verify that the auto-generated columns list (by position) has valid column positions for the table.

private void
verifyAutoGeneratedColumnsNames(String[] columnNames, UUID targetUUID)

Verify that the auto-generated columns list (by name) has valid column names for the table.

protected void
Inherited from org.apache.derby.impl.sql.execute.DMLWriteResultSet:
decodeLockModegetIndexNameFromCIDgetNextRowCoregetResultDescriptionmakeDeferredSparseRowmodifiedRowCountnormalizeRowrememberConstraint

Field Detail

aiCacheback to summary
protected DataValueDescriptor[] aiCache

keeps track of autoincrement values that are generated by getSetAutoincrementValues.

autoGeneratedKeysColumnIndexesback to summary
protected int[] autoGeneratedKeysColumnIndexes
autoGeneratedKeysResultSetback to summary
protected ResultSet autoGeneratedKeysResultSet
autoGeneratedKeysRowsHolderback to summary
protected TemporaryRowHolderImpl autoGeneratedKeysRowsHolder
autoincrementGeneratedback to summary
protected boolean autoincrementGenerated

If set to true, implies that Derby has generated autoincrement values for this (rep)resultset. During refresh for example, the autoincrement values are not generated but sent from the source to target or vice-versa.

identitySequenceUUIDStringback to summary
protected String identitySequenceUUIDString
identityValback to summary
protected long identityVal
setIdentityback to summary
protected boolean setIdentity
sourceResultSetback to summary
protected NoPutResultSet sourceResultSet

Constructor Detail

DMLWriteGeneratedColumnsResultSetback to summary
pack-priv DMLWriteGeneratedColumnsResultSet(Activation activation) throws StandardException

Constructor

Parameters
activation:Activation

an activation

Exceptions
StandardException:
on error
DMLWriteGeneratedColumnsResultSetback to summary
pack-priv DMLWriteGeneratedColumnsResultSet(Activation activation, ConstantAction constantAction) throws StandardException

Method Detail

firstExecuteSpecialHandlingAutoGenback to summary
protected void firstExecuteSpecialHandlingAutoGen(boolean firstExecute, RowChanger rowChanger, UUID targetUUID) throws StandardException
generatedColumnPositionsArrayback to summary
private int[] generatedColumnPositionsArray(UUID targetUUID) throws StandardException

If user didn't provide columns list for auto-generated columns, then only include columns with auto-generated values in the resultset. Those columns would be ones with default value defined.

getAutoGeneratedKeysResultsetback to summary
public ResultSet getAutoGeneratedKeysResultset()

Overrides org.apache.derby.impl.sql.execute.NoRowsResultSetImpl.getAutoGeneratedKeysResultset.

Implements org.apache.derby.iapi.sql.ResultSet.getAutoGeneratedKeysResultset.

Doc from org.apache.derby.iapi.sql.ResultSet.getAutoGeneratedKeysResultset.

ResultSet for rows inserted into the table (contains auto-generated keys columns only)

Returns:ResultSet

NoPutResultSet NoPutResultSets for rows inserted into the table.

Annotations
@Override
getCompactRowback to summary
protected ExecRow getCompactRow(ExecRow inputRow, int[] columnIndexes) throws StandardException

Take the input row and return a new compact ExecRow using the column positions provided in columnIndexes. Copies references, no cloning.

getSetAutoincrementValueback to summary
public NumberDataValue getSetAutoincrementValue(int columnPosition, long increment) throws StandardException

getSetAutoincrementValue will get the autoincrement value of the columnPosition specified for the target table. If increment is non-zero we will also update the autoincrement value.

Parameters
columnPosition:int

position of the column in the table (1-based)

increment:long

amount of increment.

Exceptions
StandardException:
if anything goes wrong.
saveAIcacheInformationback to summary
public void saveAIcacheInformation(String schemaName, String tableName, String[] columnNames) throws StandardException
uniqueColumnPositionArrayback to summary
private int[] uniqueColumnPositionArray(int[] columnIndexes, UUID targetUUID) throws StandardException

Remove duplicate columns from the array. Then use this array to generate a sub-set of insert resultset to be returned for JDBC3.0 getGeneratedKeys() call.

verifyAutoGenColumnback to summary
private boolean verifyAutoGenColumn(ColumnDescriptor cd)

Check that the received ColumnDescriptor corresponds to a column for which it is possible to fetch auto-generated keys.

verifyAutoGeneratedColumnsIndexesback to summary
private void verifyAutoGeneratedColumnsIndexes(int[] columnIndexes, UUID targetUUID) throws StandardException

Verify that the auto-generated columns list (by position) has valid column positions for the table.

verifyAutoGeneratedColumnsNamesback to summary
private void verifyAutoGeneratedColumnsNames(String[] columnNames, UUID targetUUID) throws StandardException

Verify that the auto-generated columns list (by name) has valid column names for the table. If all the column names are valid, convert column names array to corresponding column positions array Save that column positions array in activation. We do this to simplify the rest of the logic(it only has to deal with column positions here after).

Exceptions
StandardException:
Thrown on error if invalid column name in the list.
verifyAutoGeneratedRScolumnsListback to summary
protected void verifyAutoGeneratedRScolumnsList(UUID targetUUID) throws StandardException