本文整理了Java中org.jdbi.v3.core.Jdbi.setSqlLogger()
方法的一些代码示例,展示了Jdbi.setSqlLogger()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Jdbi.setSqlLogger()
方法的具体详情如下:
包路径:org.jdbi.v3.core.Jdbi
类名称:Jdbi
方法名:setSqlLogger
暂无
代码示例来源:origin: jdbi/jdbi
@Override
public void logException(StatementContext context, SQLException ex) {
jdbi.setSqlLogger(SqlLogger.NOP_SQL_LOGGER);
}
});
代码示例来源:origin: jdbi/jdbi
@Override
public void logAfterExecution(StatementContext context) {
jdbi.setSqlLogger(SqlLogger.NOP_SQL_LOGGER);
}
代码示例来源:origin: jdbi/jdbi
private void recordNextTimestamp(String name) {
final Jdbi jdbi = dbRule.getJdbi();
jdbi.setSqlLogger(new SqlLogger() {
@Override
public void logBeforeExecution(StatementContext ctx) {
String toString = ctx.getBinding()
.findForName(name, ctx)
.orElseThrow(AssertionError::new)
.toString();
insertedTimestamp = OffsetDateTime.parse(toString);
insertedSqlTimestamp = Timestamp.from(insertedTimestamp.toInstant());
}
@Override
public void logAfterExecution(StatementContext context) {
jdbi.setSqlLogger(SqlLogger.NOP_SQL_LOGGER);
}
@Override
public void logException(StatementContext context, SQLException ex) {
jdbi.setSqlLogger(SqlLogger.NOP_SQL_LOGGER);
}
});
}
代码示例来源:origin: org.jdbi/jdbi3-sqlobject
@Override
public void logException(StatementContext context, SQLException ex) {
jdbi.setSqlLogger(SqlLogger.NOP_SQL_LOGGER);
}
});
代码示例来源:origin: org.jdbi/jdbi3-sqlobject
@Override
public void logAfterExecution(StatementContext context) {
jdbi.setSqlLogger(SqlLogger.NOP_SQL_LOGGER);
}
代码示例来源:origin: org.jdbi/jdbi3-sqlobject
private void recordNextTimestamp(String name) {
final Jdbi jdbi = dbRule.getJdbi();
jdbi.setSqlLogger(new SqlLogger() {
@Override
public void logBeforeExecution(StatementContext ctx) {
String toString = ctx.getBinding()
.findForName(name, ctx)
.orElseThrow(AssertionError::new)
.toString();
timestamp = OffsetDateTime.parse(toString);
sqlTimestamp = Timestamp.from(timestamp.toInstant());
}
@Override
public void logAfterExecution(StatementContext context) {
jdbi.setSqlLogger(SqlLogger.NOP_SQL_LOGGER);
}
@Override
public void logException(StatementContext context, SQLException ex) {
jdbi.setSqlLogger(SqlLogger.NOP_SQL_LOGGER);
}
});
}
代码示例来源:origin: MarquezProject/marquez
private void registerResources(@NonNull MarquezConfig config, @NonNull Environment env) {
final JdbiFactory factory = new JdbiFactory();
final Jdbi jdbi =
factory
.build(env, config.getDataSourceFactory(), POSTGRES_DB)
.installPlugin(new SqlObjectPlugin())
.installPlugin(new PostgresPlugin());
jdbi.setSqlLogger(new InstrumentedSqlLogger(env.metrics()));
final NamespaceDao namespaceDao = jdbi.onDemand(NamespaceDao.class);
final JobDao jobDao = jdbi.onDemand(JobDao.class);
final JobVersionDao jobVersionDao = jdbi.onDemand(JobVersionDao.class);
final JobRunDao jobRunDao = jdbi.onDemand(JobRunDao.class);
final JobRunArgsDao jobRunArgsDao = jdbi.onDemand(JobRunArgsDao.class);
final DatasetDao datasetDao = jdbi.onDemand(DatasetDao.class);
final NamespaceService namespaceService = new NamespaceService(namespaceDao);
final JobService jobService = new JobService(jobDao, jobVersionDao, jobRunDao, jobRunArgsDao);
env.jersey().register(new PingResource());
env.jersey().register(new HealthResource());
env.jersey().register(new NamespaceResource(namespaceService));
env.jersey().register(new JobResource(namespaceService, jobService));
env.jersey().register(new DatasetResource(namespaceService, new DatasetService(datasetDao)));
env.jersey().register(new ResourceExceptionMapper());
}
}
内容来源于网络,如有侵权,请联系作者删除!