* they're not needed and they wouldn't work in a read only database.
* We can't set savepoints for commit/rollback because they'll get
* blown away before we try to clear them.
*/
LanguageConnectionContext lccToUse = activation.getLanguageConnectionContext();
if (lccToUse.getLogStatementText())
{
HeaderPrintWriter istream = Monitor.getStream();
String xactId = lccToUse.getTransactionExecute().getActiveStateTxIdString();
String pvsString = "";
ParameterValueSet pvs = activation.getParameterValueSet();
if (pvs != null && pvs.getParameterCount() > 0)
{
pvsString = " with " + pvs.getParameterCount() +
" parameters " + pvs.toString();
}
istream.printlnWithHeader(LanguageConnectionContext.xidStr +
xactId +
"), " +
LanguageConnectionContext.lccStr +
lccToUse.getInstanceNumber() +
"), " +
LanguageConnectionContext.dbnameStr +
lccToUse.getDbname() +
"), " +
LanguageConnectionContext.drdaStr +
lccToUse.getDrdaID() +
"), Executing prepared statement: " +
getSource() +
" :End prepared statement" +
pvsString);
}
ParameterValueSet pvs = activation.getParameterValueSet();
/* put it in try block to unlock the PS in any case
*/
if (!spsAction) {
// only re-prepare if this isn't an SPS for a trigger-action;
// if it _is_ an SPS for a trigger action, then we can't just
// do a regular prepare because the statement might contain
// internal SQL that isn't allowed in other statements (such as a
// static method call to get the trigger context for retrieval
// of "new row" or "old row" values). So in that case we
// skip the call to 'rePrepare' and if the statement is out
// of date, we'll get a NEEDS_COMPILE exception when we try
// to execute. That exception will be caught by the executeSPS()
// method of the GenericTriggerExecutor class, and at that time
// the SPS action will be recompiled correctly.
rePrepare(lccToUse);
}
StatementContext statementContext = lccToUse.pushStatementContext(
isAtomic, updateMode==CursorNode.READ_ONLY, getSource(), pvs, rollbackParentContext, timeoutMillis);
if (needsSavepoint())
{
/* Mark this position in the log so that a statement
* rollback will undo any changes.
*/
statementContext.setSavePoint();
needToClearSavePoint = true;
}
if (executionConstants != null)
{
lccToUse.validateStmtExecution(executionConstants);
}
ResultSet resultSet = null;
try {
resultSet = activation.execute();
resultSet.open();
} catch (StandardException se) {
/* Cann't handle recompiling SPS action recompile here */
if (!se.getMessageId().equals(SQLState.LANG_STATEMENT_NEEDS_RECOMPILE)
|| spsAction)
throw se;
statementContext.cleanupOnError(se);
continue recompileOutOfDatePlan;
}
if (needToClearSavePoint)
{
/* We're done with our updates */
statementContext.clearSavePoint();
}
lccToUse.popStatementContext(statementContext, null);
if (activation.isSingleExecution() && resultSet.isClosed())
{
// if the result set is 'done', i.e. not openable,
// then we can also release the activation.