Java 类org.jooq.ExecuteContext 实例源码

项目:zipkin    文件:TraceZipkinMySQLStorageAutoConfiguration.java   
@Override
public void renderEnd(ExecuteContext ctx) {
  // Only join traces, don't start them. This prevents LocalCollector's thread from amplifying.
  if (brave.serverSpanThreadBinder().getCurrentServerSpan() == null ||
      brave.serverSpanThreadBinder().getCurrentServerSpan().getSpan() == null) {
    return;
  }

  brave.clientTracer().startNewSpan(ctx.type().toString().toLowerCase());
  String[] batchSQL = ctx.batchSQL();
  if (!StringUtils.isBlank(ctx.sql())) {
    brave.clientTracer().submitBinaryAnnotation(SQL_QUERY, ctx.sql());
  } else if (batchSQL.length > 0 && batchSQL[batchSQL.length - 1] != null) {
    brave.clientTracer().submitBinaryAnnotation(SQL_QUERY, StringUtils.join(batchSQL, '\n'));
  }
  brave.clientTracer()
      .setClientSent(mysqlEndpoint.ipv4, mysqlEndpoint.port, mysqlEndpoint.serviceName);
}
项目:zipkin    文件:TraceZipkinMySQLStorageAutoConfiguration.java   
@Override
public void executeEnd(ExecuteContext ctx) {
  if (brave.serverSpanThreadBinder().getCurrentServerSpan() == null ||
      brave.serverSpanThreadBinder().getCurrentServerSpan().getSpan() == null) {
    return;
  }
  brave.clientTracer().setClientReceived();
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:JooqExceptionTranslator.java   
private SQLExceptionTranslator getTranslator(ExecuteContext context) {
    SQLDialect dialect = context.configuration().dialect();
    if (dialect != null && dialect.thirdParty() != null) {
        return new SQLErrorCodeSQLExceptionTranslator(
                dialect.thirdParty().springDbName());
    }
    return new SQLStateSQLExceptionTranslator();
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:JooqExceptionTranslator.java   
/**
 * Handle a single exception in the chain. SQLExceptions might be nested multiple
 * levels deep. The outermost exception is usually the least interesting one (
 * "Call getNextException to see the cause."). Therefore the innermost exception is
 * propagated and all other exceptions are logged.
 * @param context the execute context
 * @param translator the exception translator
 * @param exception the exception
 */
private void handle(ExecuteContext context, SQLExceptionTranslator translator,
        SQLException exception) {
    DataAccessException translated = translate(context, translator, exception);
    if (exception.getNextException() == null) {
        context.exception(translated);
    }
    else {
        logger.error("Execution of SQL statement failed.", translated);
    }
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:JooqExceptionTranslatorTests.java   
@Test
public void exceptionTranslation() {
    ExecuteContext context = mock(ExecuteContext.class);
    Configuration configuration = mock(Configuration.class);
    given(context.configuration()).willReturn(configuration);
    given(configuration.dialect()).willReturn(this.dialect);
    given(context.sqlException()).willReturn(this.sqlException);
    this.exceptionTranslator.exception(context);
    ArgumentCaptor<RuntimeException> captor = ArgumentCaptor
            .forClass(RuntimeException.class);
    verify(context).exception(captor.capture());
    assertThat(captor.getValue()).isInstanceOf(BadSqlGrammarException.class);
}
项目:spring-boot-concourse    文件:JooqExceptionTranslator.java   
private SQLExceptionTranslator getTranslator(ExecuteContext context) {
    SQLDialect dialect = context.configuration().dialect();
    if (dialect != null && dialect.thirdParty() != null) {
        return new SQLErrorCodeSQLExceptionTranslator(
                dialect.thirdParty().springDbName());
    }
    return new SQLStateSQLExceptionTranslator();
}
项目:spring-boot-concourse    文件:JooqExceptionTranslator.java   
/**
 * Handle a single exception in the chain. SQLExceptions might be nested multiple
 * levels deep. The outermost exception is usually the least interesting one (
 * "Call getNextException to see the cause."). Therefore the innermost exception is
 * propagated and all other exceptions are logged.
 * @param context the execute context
 * @param translator the exception translator
 * @param exception the exception
 */
private void handle(ExecuteContext context, SQLExceptionTranslator translator,
        SQLException exception) {
    DataAccessException translated = translate(context, translator, exception);
    if (exception.getNextException() == null) {
        context.exception(translated);
    }
    else {
        logger.error("Execution of SQL statement failed.", translated);
    }
}
项目:spring-boot-concourse    文件:JooqExceptionTranslatorTests.java   
@Test
public void exceptionTranslation() {
    ExecuteContext context = mock(ExecuteContext.class);
    Configuration configuration = mock(Configuration.class);
    given(context.configuration()).willReturn(configuration);
    given(configuration.dialect()).willReturn(this.dialect);
    given(context.sqlException()).willReturn(this.sqlException);
    this.exceptionTranslator.exception(context);
    ArgumentCaptor<RuntimeException> captor = ArgumentCaptor
            .forClass(RuntimeException.class);
    verify(context).exception(captor.capture());
    assertThat(captor.getValue()).isInstanceOf(BadSqlGrammarException.class);
}
项目:unipop    文件:TimingExecuterListener.java   
@Override
public void fetchEnd(ExecuteContext ctx) {
    super.fetchEnd(ctx);

    Pair<Long, Integer> stopWatchIntegerPair = timing.get(ctx.query().toString());
    long duration = System.nanoTime() - stopWatchIntegerPair.getValue0();
    timing.put(ctx.query().toString(), new Pair<>(duration, ctx.result().size()));
}
项目:unipop    文件:TimingExecuterListener.java   
@Override
public void fetchStart(ExecuteContext ctx) {
    super.start(ctx);
    StopWatch stopWatch = new StopWatch();
    timing.put(ctx.query().toString(), new Pair<>(System.nanoTime(), 0));
    stopWatch.start();
}
项目:contestparser    文件:JooqExceptionTranslator.java   
private SQLExceptionTranslator getTranslator(ExecuteContext context) {
    SQLDialect dialect = context.configuration().dialect();
    if (dialect != null) {
        return new SQLErrorCodeSQLExceptionTranslator(dialect.name());
    }
    return new SQLStateSQLExceptionTranslator();
}
项目:contestparser    文件:JooqExceptionTranslator.java   
/**
 * Handle a single exception in the chain. SQLExceptions might be nested multiple
 * levels deep. The outermost exception is usually the least interesting one (
 * "Call getNextException to see the cause."). Therefore the innermost exception is
 * propagated and all other exceptions are logged.
 * @param context the execute context
 * @param translator the exception translator
 * @param exception the exception
 */
private void handle(ExecuteContext context, SQLExceptionTranslator translator,
        SQLException exception) {
    DataAccessException translated = translate(context, translator, exception);
    if (exception.getNextException() == null) {
        context.exception(translated);
    }
    else {
        logger.error("Execution of SQL statement failed.", translated);
    }
}
项目:modules-main    文件:JooqLogger.java   
@Override
public void renderEnd(ExecuteContext ctx)
{
    if (database.getDatabaseConfig().logDatabaseQueries)
    {
        database.getLog().debug(ctx.query().getSQL());
    }
}
项目:AdvancedDataProfilingSeminar    文件:Helper.java   
@Override
public void start(final ExecuteContext ctx) {
  System.err.println("Query: " + ctx.query().getSQL());
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:JooqExceptionTranslator.java   
private DataAccessException translate(ExecuteContext context,
        SQLExceptionTranslator translator, SQLException exception) {
    return translator.translate("jOOQ", context.sql(), exception);
}
项目:spring-boot-concourse    文件:JooqExceptionTranslator.java   
private DataAccessException translate(ExecuteContext context,
        SQLExceptionTranslator translator, SQLException exception) {
    return translator.translate("jOOQ", context.sql(), exception);
}
项目:contestparser    文件:JooqExceptionTranslator.java   
private DataAccessException translate(ExecuteContext context,
        SQLExceptionTranslator translator, SQLException exception) {
    return translator.translate("jOOQ", context.sql(), exception);
}