}
}
// if this was a prepared statement, this just
// gets it for us, it won't recompile unless it is invalid.
PreparedStatement ps = a.getPreparedStatement();
ps.rePrepare(lcc);
getWarnings(ps.getCompileTimeWarnings());
/*
** WARNING WARNING
**
** Any state set in the activation before execution *must* be copied
** to the new activation in GenericActivationHolder.execute() when
** the statement has been recompiled. State such as
** singleExecution, cursorName, holdability, maxRows.
*/
if (cursorName != null)
{
a.setCursorName(cursorName);
}
a.setResultSetHoldability(resultSetHoldability != JDBC30Translation.CLOSE_CURSORS_AT_COMMIT);
//reset the activation to clear warnings
//and clear existing result sets in case this has been cached
a.reset();
a.setMaxRows(maxRows);
ResultSet resultsToWrap = ps.execute(a, executeQuery, executeUpdate, false);
getWarnings(a.getWarnings());
if (resultsToWrap.returnsRows()) {
EmbedResultSet lresults = factory.newEmbedResultSet(getEmbedConnection(), resultsToWrap, forMetaData, this, ps.isAtomic());
results = lresults;
// Set up the finalization of the ResultSet to
// mark the activation as unused. It will be
// closed sometime later by the connection
// outside of finalization.
if (a.isSingleExecution())
lresults.finalizeActivation = a;
updateCount = -1;
retval = true;
}
else {
// Only applipable for an insert statement, which does not return rows.
//the auto-generated keys resultset will be null if used for non-insert statement
if (a.getAutoGeneratedKeysResultsetMode() && (resultsToWrap.getAutoGeneratedKeysResultset() != null))
{
resultsToWrap.getAutoGeneratedKeysResultset().open();
autoGeneratedKeysResultSet = factory.newEmbedResultSet(getEmbedConnection(),
resultsToWrap.getAutoGeneratedKeysResultset(), false, this, ps.isAtomic());
}
updateCount = resultsToWrap.modifiedRowCount();
resultsToWrap.finish(); // Don't need the result set any more