//reset the activation to clear warnings
//and clear existing result sets in case this has been cached
a.reset();
a.setMaxRows(maxRows);
long timeoutMillis = (long)timeoutSeconds * 1000L;
ResultSet resultsToWrap = ps.execute(a,
false,
timeoutMillis);
addWarning(a.getWarnings());
if (resultsToWrap.returnsRows()) {
// The statement returns rows, so calling it with
// executeUpdate() is not allowed.
if (executeUpdate) {
throw StandardException.newException(
SQLState.LANG_INVALID_CALL_TO_EXECUTE_UPDATE);
}
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.singleUseActivation = 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
results = null; // note that we have none.
int dynamicResultCount = 0;
if (a.getDynamicResults() != null) {
dynamicResultCount =