public boolean execute()
throws SQLException
{
_count++;
DbTransaction xa = null;
try {
if (_count != 1)
throw new IllegalStateException("Multithreading execute");
xa = _conn.getTransaction();
QueryContext queryContext = getQueryContext();
if (_query.isSelect()) {
_query.execute(queryContext, xa);
_wasResultSet = true;
_resultSet = new ResultSetImpl(this, queryContext.getResult());
return true;
}
else {
queryContext.setReturnGeneratedKeys(_isReturnGeneratedKeys);
_query.execute(queryContext, xa);
_wasResultSet = false;
return false;
}
} finally {
_count--;
if (xa != null && xa.isAutoCommit())
xa.rollback();
}
}