int parentStatementDepth = statementDepth;
boolean inTrigger = false;
boolean parentIsAtomic = false;
// by default, assume we are going to use the outermost statement context
StatementContext statementContext = statementContexts[0];
/*
** If we haven't allocated any statement contexts yet, allocate
** the outermost stmt context now and push it.
*/
if (statementContext == null)
{
statementContext = statementContexts[0] = new GenericStatementContext(this);
statementContext.
setSQLSessionContext(getTopLevelSQLSessionContext());
}
else if (statementDepth > 0)
{
StatementContext parentStatementContext;
/*
** We also cache a 2nd statement context, though we still
** push and pop it. Note, new contexts are automatically pushed.
*/
if (statementDepth == 1)
{
statementContext = statementContexts[1];
if (statementContext == null)
statementContext = statementContexts[1] = new GenericStatementContext(this);
else
statementContext.pushMe();
parentStatementContext = statementContexts[0];
}
else
{
parentStatementContext = getStatementContext();
statementContext = new GenericStatementContext(this);
}
statementContext.setSQLSessionContext(
parentStatementContext.getSQLSessionContext());
inTrigger = parentStatementContext.inTrigger() || (outermostTrigger == parentStatementDepth);
parentIsAtomic = parentStatementContext.isAtomic();
statementContext.setSQLAllowed(parentStatementContext.getSQLAllowed(), false);
if (parentStatementContext.getSystemCode())
statementContext.setSystemCode();
} else {
statementContext.
setSQLSessionContext(getTopLevelSQLSessionContext());
}