use of jnc.platform.win32.Handle in project dropwizard by dropwizard.
the class GuavaOptionalZonedDateTimeTest method setupTests.
@Before
public void setupTests() throws IOException {
final DataSourceFactory dataSourceFactory = new DataSourceFactory();
dataSourceFactory.setDriverClass("org.h2.Driver");
dataSourceFactory.setUrl("jdbc:h2:mem:guava-zoned-date-time-" + System.currentTimeMillis() + "?user=sa");
dataSourceFactory.setInitialSize(1);
final DBI dbi = new DBIFactory().build(env, dataSourceFactory, "test");
try (Handle h = dbi.open()) {
h.execute("CREATE TABLE IF NOT EXISTS tasks (" + "id INT PRIMARY KEY, " + "assignee VARCHAR(255) NOT NULL, " + "start_date TIMESTAMP, " + "end_date TIMESTAMP, " + "comments VARCHAR(1024) " + ")");
}
dao = dbi.onDemand(TaskDao.class);
}
use of jnc.platform.win32.Handle in project dropwizard by dropwizard.
the class OptionalDateTimeTest method setupTests.
@Before
public void setupTests() throws IOException {
final DataSourceFactory dataSourceFactory = new DataSourceFactory();
dataSourceFactory.setDriverClass("org.h2.Driver");
dataSourceFactory.setUrl("jdbc:h2:mem:date-time-optional-" + System.currentTimeMillis() + "?user=sa");
dataSourceFactory.setInitialSize(1);
final DBI dbi = new DBIFactory().build(env, dataSourceFactory, "test");
try (Handle h = dbi.open()) {
h.execute("CREATE TABLE IF NOT EXISTS tasks (" + "id INT PRIMARY KEY, " + "assignee VARCHAR(255) NOT NULL, " + "start_date TIMESTAMP, " + "end_date TIMESTAMP, " + "comments VARCHAR(1024) " + ")");
}
dao = dbi.onDemand(TaskDao.class);
}
use of jnc.platform.win32.Handle in project dropwizard by dropwizard.
the class OptionalLocalDateTest method setupTests.
@Before
public void setupTests() throws IOException {
final DataSourceFactory dataSourceFactory = new DataSourceFactory();
dataSourceFactory.setDriverClass("org.h2.Driver");
dataSourceFactory.setUrl("jdbc:h2:mem:optional-local-date-" + System.currentTimeMillis() + "?user=sa");
dataSourceFactory.setInitialSize(1);
final DBI dbi = new DBIFactory().build(env, dataSourceFactory, "test");
try (Handle h = dbi.open()) {
h.execute("CREATE TABLE IF NOT EXISTS tasks (" + "id INT PRIMARY KEY, " + "assignee VARCHAR(255) NOT NULL, " + "start_date TIMESTAMP, " + "end_date TIMESTAMP, " + "comments VARCHAR(1024) " + ")");
}
dao = dbi.onDemand(TaskDao.class);
}
use of jnc.platform.win32.Handle in project dropwizard by dropwizard.
the class OptionalLocalDateTimeTest method setupTests.
@Before
public void setupTests() throws IOException {
final DataSourceFactory dataSourceFactory = new DataSourceFactory();
dataSourceFactory.setDriverClass("org.h2.Driver");
dataSourceFactory.setUrl("jdbc:h2:mem:optional-local-date-time" + System.currentTimeMillis() + "?user=sa");
dataSourceFactory.setInitialSize(1);
final DBI dbi = new DBIFactory().build(env, dataSourceFactory, "test");
try (Handle h = dbi.open()) {
h.execute("CREATE TABLE IF NOT EXISTS tasks (" + "id INT PRIMARY KEY, " + "assignee VARCHAR(255) NOT NULL, " + "start_date TIMESTAMP, " + "end_date TIMESTAMP, " + "comments VARCHAR(1024) " + ")");
}
dao = dbi.onDemand(TaskDao.class);
}
use of jnc.platform.win32.Handle in project druid by druid-io.
the class JDBCExtractionNamespaceCacheFactory method lastUpdates.
private Long lastUpdates(CacheScheduler.EntryImpl<JDBCExtractionNamespace> id, JDBCExtractionNamespace namespace) {
final DBI dbi = ensureDBI(id, namespace);
final String table = namespace.getTable();
final String tsColumn = namespace.getTsColumn();
if (tsColumn == null) {
return null;
}
final Timestamp update = dbi.withHandle(new HandleCallback<Timestamp>() {
@Override
public Timestamp withHandle(Handle handle) throws Exception {
final String query = String.format("SELECT MAX(%s) FROM %s", tsColumn, table);
return handle.createQuery(query).map(TimestampMapper.FIRST).first();
}
});
return update.getTime();
}
Aggregations