*/
protected void openCore() throws StandardException
{
lcc.getStatementContext().setTopResultSet(this, subqueryTrackingArray);
ExecRow row = getNextRowCore(sourceResultSet);
if (row != null)
{
rs = activation.getTargetVTI();
if (SanityManager.DEBUG)
{
SanityManager.ASSERT(rs != null,
"rs expected to be non-null");
}
}
/* The source does not know whether or not we are doing a
* deferred mode delete. If we are, then we must clear the
* index scan info from the activation so that the row changer
* does not re-use that information (which won't be valid for
* a deferred mode delete).
*/
if (constants.deferred)
{
activation.clearIndexScanInfo();
if( null == rowHolder)
rowHolder =
new TemporaryRowHolderImpl(activation, new Properties(),
(ResultDescription) null);
}
try
{
while ( row != null )
{
if( !constants.deferred)
rs.deleteRow();
else
{
ExecRow rowId = new ValueRow(1);
rowId.setColumn( 1, new SQLInteger( rs.getRow()));
rowHolder.insert( rowId);
}
rowCount++;
// No need to do a next on a single row source
if (constants.singleRowSource)
{
row = null;
}
else
{
row = getNextRowCore(sourceResultSet);
}
}
}
catch (StandardException se)
{
throw se;
}
catch (Throwable t)
{
throw StandardException.unexpectedUserException(t);
}
if (constants.deferred)
{
CursorResultSet tempRS = rowHolder.getResultSet();
try
{
ExecRow deferredRowBuffer = null;
tempRS.open();
while ((deferredRowBuffer = tempRS.getNextRow()) != null)
{
int rowNumber = deferredRowBuffer.getColumn( 1).getInt();
rs.absolute( rowNumber);
rs.deleteRow();
}
}
catch (Throwable t)