use of org.dbflute.jdbc.ExecutionTimeInfo in project dbflute-core by dbflute.
the class TnAbstractBasicSqlHandler method hookSqlFireFinally.
protected void hookSqlFireFinally(Object nativeResult, SQLException nativeCause) {
if (!hasSqlFireHook()) {
return;
}
final SqlLogInfo sqlLogInfo = InternalMapContext.getHookSqlLogInfo();
final Long sqlBefore = InternalMapContext.getSqlBeforeTimeMillis();
final Long sqlAfter = InternalMapContext.getSqlAfterTimeMillis();
final ExecutionTimeInfo timeInfo = new ExecutionTimeInfo(null, null, sqlBefore, sqlAfter);
final SqlFireResultInfo fireResultInfo = new SqlFireResultInfo(nativeResult, sqlLogInfo, timeInfo, nativeCause);
getSqlFireHook().hookFinally(ResourceContext.behaviorCommand(), fireResultInfo);
}
use of org.dbflute.jdbc.ExecutionTimeInfo in project dbflute-core by dbflute.
the class BehaviorCommandInvoker method callbackSqlResultHanler.
protected <RESULT> void callbackSqlResultHanler(BehaviorCommand<RESULT> behaviorCommand, SqlResultHandler sqlResultHander, Object ret, Long commandBefore, Long commandAfter, RuntimeException cause) {
final SqlLogInfo sqlLogInfo = getResultSqlLogInfo(behaviorCommand);
final Long sqlBefore = InternalMapContext.getSqlBeforeTimeMillis();
final Long sqlAfter = InternalMapContext.getSqlAfterTimeMillis();
final ExecutionTimeInfo timeInfo = new ExecutionTimeInfo(commandBefore, commandAfter, sqlBefore, sqlAfter);
final SqlResultInfo info = new SqlResultInfo(behaviorCommand, ret, sqlLogInfo, timeInfo, cause);
sqlResultHander.handle(info);
}
use of org.dbflute.jdbc.ExecutionTimeInfo in project lastaflute by lastaflute.
the class RomanticTraceableSqlResultHandler method handle.
@Override
public void handle(SqlResultInfo info) {
final RomanticTransaction tx = TransactionRomanticContext.getRomanticTransaction();
if (tx != null) {
// not saved because of internal object
final BehaviorCommandMeta meta = info.getMeta();
final String tableName = meta.getDBMeta().getTableDispName();
final String command = meta.getCommandName();
final ExecutionTimeInfo timeInfo = info.getExecutionTimeInfo();
final Long beginMillis = timeInfo.getCommandBeforeTimeMillis();
final Long endMillis = timeInfo.getCommandAfterTimeMillis();
final Class<?> resultType = meta.getCommandReturnType();
final Object resultValue = info.getResult();
tx.registerRecentResult(tableName, command, beginMillis, endMillis, resultType, resultValue, meta);
}
}
Aggregations