return chain.statement_execute(statement, sql);
}
long startMillis = System.currentTimeMillis();
ConnectionProxy connection = statement.getConnectionProxy();
{
TraceEvent event = new TraceEvent("StatementExecuteBefore", new Date(startMillis));
event.putContext(TRACE_CONN_INFO, connection.getProperties().clone());
event.putContext(TRACE_CONN_CONNECTED_TIME, connection.getConnectedTime());
event.putContext(TRACE_CONN_ID, connection.getId());
event.putContext(TRACE_STMT_ID, statement.getId());
event.putContext(TRACE_STMT_SQL, sql);
fireEvent(event);
}
try {
boolean result = chain.statement_execute(statement, sql);
long timespan = System.currentTimeMillis() - startMillis;
{
TraceAfterEvent event = new TraceAfterEvent("StatementExecuteAfter", new Date(startMillis), timespan);
event.putContext(TRACE_CONN_INFO, connection.getProperties().clone());
event.putContext(TRACE_CONN_CONNECTED_TIME, connection.getConnectedTime());
event.putContext(TRACE_CONN_ID, connection.getId());
event.putContext(TRACE_STMT_ID, statement.getId());
event.putContext(TRACE_STMT_SQL, sql);
fireEvent(event);
}
return result;
} catch (SQLException ex) {
{
TraceErrorEvent event = new TraceErrorEvent("StatementExecuteError", new Date(startMillis), ex);
event.putContext(TRACE_CONN_INFO, connection.getProperties().clone());
event.putContext(TRACE_CONN_CONNECTED_TIME, connection.getConnectedTime());
event.putContext(TRACE_CONN_ID, connection.getId());
event.putContext(TRACE_STMT_ID, statement.getId());
event.putContext(TRACE_STMT_SQL, sql);
fireEvent(event);
}
throw ex;
} catch (RuntimeException ex) {
{
TraceErrorEvent event = new TraceErrorEvent("StatementExecuteError", new Date(startMillis), ex);
event.putContext(TRACE_CONN_INFO, connection.getProperties().clone());
event.putContext(TRACE_CONN_CONNECTED_TIME, connection.getConnectedTime());
event.putContext(TRACE_CONN_ID, connection.getId());
event.putContext(TRACE_STMT_ID, statement.getId());
event.putContext(TRACE_STMT_SQL, sql);
fireEvent(event);
}
throw ex;