@Test public void testInstant(TestContext context) { Async async = context.async(); client.getConnection(ar -> { ensureSuccess(context, ar); conn = ar.result(); conn.execute("DROP TABLE IF EXISTS test_table", ar1 -> { ensureSuccess(context, ar1); conn.execute("CREATE TABLE test_table (instant TIMESTAMP)", ar2 -> { ensureSuccess(context, ar2); JsonArray args = new JsonArray().add(Instant.now()); String now = args.getString(0); conn.queryWithParams("INSERT INTO test_table (instant) VALUES (?)", args, ar3 -> { ensureSuccess(context, ar3); conn.query("SELECT instant FROM test_table", ar4 -> { ensureSuccess(context, ar4); // timestamps with out time zone are returned as strings, so we must compare to the original instant // ignoring the timezone offset (meaning ignore everything after char 23) compareInstantStrings( context, ar4.result().getResults().get(0).getString(0), now.substring(0, 23) ); async.complete(); }); }); }); }); }); }
@Test public void testInstant(TestContext context) { Async async = context.async(); client.getConnection(ar -> { ensureSuccess(context, ar); conn = ar.result(); conn.execute("DROP TABLE IF EXISTS test_table", ar1 -> { ensureSuccess(context, ar1); conn.execute("CREATE TABLE test_table (instant TIMESTAMP)", ar2 -> { ensureSuccess(context, ar2); JsonArray args = new JsonArray().add(Instant.now()); String now = args.getString(0); conn.queryWithParams("INSERT INTO test_table (instant) VALUES (?)", args, ar3 -> { ensureSuccess(context, ar3); conn.query("SELECT instant FROM test_table", ar4 -> { ensureSuccess(context, ar4); // timestamps with out time zone are returned as strings, so we must compare to the original instant // ignoring the timezone offset (meaning ignore everything after char 23) compareInstantStrings( context, ar4.result().getResults().get(0).getString(0), now.substring(0, 23) ); async.complete(); }); }); }); }); }); }
@Test public void testInstant(TestContext context) { Async async = context.async(); client.getConnection(ar -> { ensureSuccess(context, ar); conn = ar.result(); conn.execute("DROP TABLE IF EXISTS test_table", ar1 -> { ensureSuccess(context, ar1); conn.execute("CREATE TABLE test_table (instant TIMESTAMP)", ar2 -> { ensureSuccess(context, ar2); JsonArray args = new JsonArray().add(Instant.now()); String now = args.getString(0); conn.queryWithParams("INSERT INTO test_table (instant) VALUES (?)", args, ar3 -> { ensureSuccess(context, ar3); conn.query("SELECT instant FROM test_table", ar4 -> { ensureSuccess(context, ar4); // timestamps with out time zone are returned as strings, so we must compare to the original instant // ignoring the timezone offset (meaning ignore everything after char 23) compareInstantStrings( context, ar4.result().getResults().get(0).getString(0), now.substring(0, 23) ); async.complete(); }); }); }); }); }); }