Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<properties>
<stack.version>3.3.0-SNAPSHOT</stack.version>
<scala.version>2.11.4</scala.version>
<asyncdriver.version>0.2.18</asyncdriver.version>
<asyncdriver.version>0.2.19</asyncdriver.version>

<host>localhost</host>
</properties>
Expand Down
10 changes: 9 additions & 1 deletion src/main/java/io/vertx/ext/asyncsql/impl/BaseSQLClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;

Expand Down Expand Up @@ -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,
Expand Down
31 changes: 31 additions & 0 deletions src/test/java/io/vertx/ext/asyncsql/PostgreSQLTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
});
});
});
});
});
});
}

}