本文整理汇总了Java中org.jooq.ExecuteContext类的典型用法代码示例。如果您正苦于以下问题:Java ExecuteContext类的具体用法?Java ExecuteContext怎么用?Java ExecuteContext使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ExecuteContext类属于org.jooq包,在下文中一共展示了ExecuteContext类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: renderEnd
import org.jooq.ExecuteContext; //导入依赖的package包/类
@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);
}
示例2: executeEnd
import org.jooq.ExecuteContext; //导入依赖的package包/类
@Override
public void executeEnd(ExecuteContext ctx) {
if (brave.serverSpanThreadBinder().getCurrentServerSpan() == null ||
brave.serverSpanThreadBinder().getCurrentServerSpan().getSpan() == null) {
return;
}
brave.clientTracer().setClientReceived();
}
示例3: getTranslator
import org.jooq.ExecuteContext; //导入依赖的package包/类
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();
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:9,代码来源:JooqExceptionTranslator.java
示例4: handle
import org.jooq.ExecuteContext; //导入依赖的package包/类
/**
* 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);
}
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:20,代码来源:JooqExceptionTranslator.java
示例5: exceptionTranslation
import org.jooq.ExecuteContext; //导入依赖的package包/类
@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);
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:14,代码来源:JooqExceptionTranslatorTests.java
示例6: fetchEnd
import org.jooq.ExecuteContext; //导入依赖的package包/类
@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()));
}
示例7: fetchStart
import org.jooq.ExecuteContext; //导入依赖的package包/类
@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();
}
示例8: getTranslator
import org.jooq.ExecuteContext; //导入依赖的package包/类
private SQLExceptionTranslator getTranslator(ExecuteContext context) {
SQLDialect dialect = context.configuration().dialect();
if (dialect != null) {
return new SQLErrorCodeSQLExceptionTranslator(dialect.name());
}
return new SQLStateSQLExceptionTranslator();
}
示例9: renderEnd
import org.jooq.ExecuteContext; //导入依赖的package包/类
@Override
public void renderEnd(ExecuteContext ctx)
{
if (database.getDatabaseConfig().logDatabaseQueries)
{
database.getLog().debug(ctx.query().getSQL());
}
}
示例10: start
import org.jooq.ExecuteContext; //导入依赖的package包/类
@Override
public void start(final ExecuteContext ctx) {
System.err.println("Query: " + ctx.query().getSQL());
}
示例11: translate
import org.jooq.ExecuteContext; //导入依赖的package包/类
private DataAccessException translate(ExecuteContext context,
SQLExceptionTranslator translator, SQLException exception) {
return translator.translate("jOOQ", context.sql(), exception);
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:5,代码来源:JooqExceptionTranslator.java