diff --git a/pom.xml b/pom.xml index 99b17c7b..aa9b1745 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ 3.3.0-SNAPSHOT 2.11.4 - 0.2.18 + 0.2.19 localhost diff --git a/src/main/java/io/vertx/ext/asyncsql/impl/BaseSQLClient.java b/src/main/java/io/vertx/ext/asyncsql/impl/BaseSQLClient.java index 133aeac3..7c901c55 100644 --- a/src/main/java/io/vertx/ext/asyncsql/impl/BaseSQLClient.java +++ b/src/main/java/io/vertx/ext/asyncsql/impl/BaseSQLClient.java @@ -18,6 +18,7 @@ import com.github.mauricio.async.db.Configuration; import com.github.mauricio.async.db.Connection; +import com.github.mauricio.async.db.SSLConfiguration; import io.netty.buffer.PooledByteBufAllocator; import io.vertx.core.AsyncResult; import io.vertx.core.Future; @@ -29,6 +30,7 @@ import io.vertx.ext.asyncsql.impl.pool.AsyncConnectionPool; import io.vertx.ext.sql.SQLConnection; import scala.Option; +import scala.collection.Map$; import scala.concurrent.ExecutionContext; import scala.concurrent.duration.Duration; @@ -116,7 +118,13 @@ protected Configuration getConfiguration( Option.empty() : Option.apply(Duration.apply(queryTimeout, TimeUnit.MILLISECONDS)); log.info("Creating configuration for " + host + ":" + port); - return new Configuration(username, host, port, Option.apply(password), Option.apply(database), + return new Configuration( + username, + host, + port, + Option.apply(password), + Option.apply(database), + SSLConfiguration.apply(Map$.MODULE$.empty()), charset, 16777216, PooledByteBufAllocator.DEFAULT, diff --git a/src/test/java/io/vertx/ext/asyncsql/PostgreSQLTest.java b/src/test/java/io/vertx/ext/asyncsql/PostgreSQLTest.java index 4e978501..4ff0b1a9 100644 --- a/src/test/java/io/vertx/ext/asyncsql/PostgreSQLTest.java +++ b/src/test/java/io/vertx/ext/asyncsql/PostgreSQLTest.java @@ -97,4 +97,35 @@ public void queryTypeTimestampWithoutTimezoneTest(TestContext context) throws Ex }); } + @Test + public void testUpdatingNumericField(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 (id BIGSERIAL, numcol NUMERIC)", ar2 -> { + ensureSuccess(context, ar2); + conn.query("INSERT INTO test_table DEFAULT VALUES RETURNING id", ar3 -> { + ensureSuccess(context, ar3); + System.out.println("result: " + ar3.result().toJson().encode()); + final long id = ar3.result().getResults().get(0).getLong(0); + conn.updateWithParams("UPDATE test_table SET numcol = ? WHERE id = ?", new JsonArray().add(1234).add(id), ar4 -> { + ensureSuccess(context, ar4); + conn.updateWithParams("UPDATE test_table SET numcol = ? WHERE id = ?", new JsonArray().addNull().add(id), ar5 -> { + ensureSuccess(context, ar5); + conn.updateWithParams("UPDATE test_table SET numcol = ? WHERE id = ?", new JsonArray().add(123.123).add(id), ar6 -> { + ensureSuccess(context, ar6); + + async.complete(); + }); + }); + }); + }); + }); + }); + }); + } + }