Vert.x 3.1 Stored Procedure OUT parameter

707 views
Skip to first unread message

Jonghwa Kim

unread,
Nov 25, 2015, 8:28:27 PM11/25/15
to vert.x
Hi all.

In Vert.x 3.1 JDBC/Common SQL, How can I get  to invoke the procedure returns OUT parameters?

Thanks in advance,
zepinos

Paulo Lopes

unread,
Nov 26, 2015, 3:34:00 AM11/26/15
to vert.x
Hi Jonghwa,

This has been implemented for 3.2 which is to be released soon, if you're keen to give it a try have a look here:

https://github.com/vert-x3/vertx-sql-common/blob/master/src/main/asciidoc/java/index.adoc#callable-statements

Jonghwa Kim

unread,
Nov 26, 2015, 3:58:24 AM11/26/15
to vert.x
Thank you so much.

Is maven repository where to receive the 3.2.0-SNAPSHOT?



2015년 11월 26일 목요일 오후 5시 34분 0초 UTC+9, Paulo Lopes 님의 말:

Clement Escoffier

unread,
Nov 26, 2015, 4:04:05 AM11/26/15
to ve...@googlegroups.com
Yes,

vert.x snapshots are deployed here:


Clement


-- 
You received this message because you are subscribed to the Google Groups "vert.x" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vertx+un...@googlegroups.com.
Visit this group at http://groups.google.com/group/vertx.
To view this discussion on the web, visit https://groups.google.com/d/msgid/vertx/80d41b09-9680-4c40-92ea-4de223a4bbfa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jonghwa Kim

unread,
Nov 26, 2015, 4:13:20 AM11/26/15
to vert.x
Thank you vary much.



2015년 11월 26일 목요일 오후 6시 4분 5초 UTC+9, clement escoffier 님의 말:

Jonghwa Kim

unread,
Nov 26, 2015, 4:41:12 AM11/26/15
to vert.x
I can not get the value of the OUT parameter.
Result is well saved



Write code looked like this:

StringBuffer sql = new StringBuffer();

sql.append(" { call test(?, ?) } ");

paramIn.add(1);
paramOut.addNull().add("BIGINT");

connection.callWithParams(sql.toString(), paramIn, paramOut, rs -> {

    if (rs.failed()) {

        rs.cause().printStackTrace();
        return;

    }

    System.out.println(paramIn);
    System.out.println(paramOut);
    System.out.println(rs.result().toJson());

});


result :

[1]
[null,"BIGINT"]
{...}

Paulo Lopes

unread,
Nov 26, 2015, 4:50:34 AM11/26/15
to vert.x
Can you provide a test procedure, we have a test that works for HSQLDB:

create procedure customer_lastname(IN firstname varchar(50), OUT lastname varchar(50))
  modifies sql data
  select lastname into lastname from customers where firstname = firstname

can you show your procedure?

Jonghwa Kim

unread,
Nov 26, 2015, 5:04:17 AM11/26/15
to vert.x
It has developed into MySQL 5.6.


procedure :

DELIMITER $$
CREATE PROCEDURE `proc_test`(IN firstname varchar(45), OUT lastname varchar(45))
BEGIN

set lastname = concat(firstname, "!!!");

select now(6);

END$$

DELIMITER ;



test result (MySQL Workbench) :

set @lastname = '0';
call proc_test('zepinos', @lastname);
select @lastname;

result1 :

2015-11-26 19:04:03.014689

result2 :

zepinos!!!


Java Code (did = "zepinos"):

final SQLConnection connection = conn.result();

StringBuffer sql = new StringBuffer();
JsonArray paramIn = new JsonArray();
JsonArray paramOut = new JsonArray();

// 유저 정보 조회
sql.append(" { call proc_test(?, ?) } ");

paramIn.add(did);
paramOut.addNull()
.add("VARCHAR");

connection.callWithParams(sql.toString(), paramIn, paramOut, rs -> {

if (rs.failed()) {

rs.cause().printStackTrace();
return;

}

   System.out.println("1 : " + paramIn);
System.out.println("2 : " + paramOut);
System.out.println("3 : " + rs.result().toJson());


});

Java Result :

1 : ["zepinos"]
2 : [null,"VARCHAR"]
3 : {"columnNames":["now(6)"],"numColumns":1,"numRows":1,"results":[["2015-11-26T10:06:32.104Z"]],"rows":[{"now(6)":"2015-11-26T10:06:32.104Z"}]}



zepinos.



2015년 11월 26일 목요일 오후 6시 50분 34초 UTC+9, Paulo Lopes 님의 말:

Paulo Lopes

unread,
Nov 26, 2015, 5:10:14 AM11/26/15
to vert.x
Thanks i'll investigate what is going on with MySQL

Paulo Lopes

unread,
Nov 26, 2015, 5:41:46 AM11/26/15
to vert.x
I've just tested your proc and noticed a null pointer exception in the toJSON code, I've pushed a fix to master and i now get the same results as you get on workbench.

I've tested with MySQL 5.7 and driver
5.1.37

If you pull the master and build locally it should work for you too.

Jonghwa Kim

unread,
Nov 26, 2015, 8:21:42 PM11/26/15
to vert.x
Nothing has changed in the Master branch.


zepinos.



2015년 11월 26일 목요일 오후 7시 41분 46초 UTC+9, Paulo Lopes 님의 말:

Paulo Lopes

unread,
Nov 27, 2015, 2:25:53 AM11/27/15
to vert.x
humm, yes it did :)

https://github.com/vert-x3/vertx-jdbc-client/commit/6a44f3192c491035daeda3fb4c249751507b670b

BTW you're using vertx-jdbc-client right? not the postgres-mysql-async right?

Jonghwa Kim

unread,
Nov 27, 2015, 2:37:17 AM11/27/15
to vert.x
Sorry.

I think they have modified the "vertx-sql-common".

I'll have to build it again.


zepinos.

Jonghwa Kim

unread,
Nov 27, 2015, 3:03:08 AM11/27/15
to vert.x
The new Code was applied, but not the desired result.

Output to the console "zepinos!!!" It is not included.

Procedure OUT parameter's value is ".callWithParams ()" will be included in the coming jsonArray1 or ResultSet?

Paulo Lopes

unread,
Nov 27, 2015, 5:06:33 AM11/27/15
to vert.x
I've run your example and it works for me, if this is not working for you can you write a full reproducer to investigate what's wrong, for reference here's my test:

/*
* Copyright (c) 2011-2014 The original author or authors
* ------------------------------------------------------
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Apache License v2.0 which accompanies this distribution.
*
* The Eclipse Public License is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* The Apache License v2.0 is available at
* http://www.opensource.org/licenses/apache2.0.php
*
* You may elect to redistribute this code under either of these licenses.
*/

package io.vertx.ext.jdbc;

import io.vertx.core.json.JsonArray;
import io.vertx.core.json.JsonObject;
import io.vertx.ext.sql.SQLConnection;
import io.vertx.test.core.VertxTestBase;
import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;

import java.sql.Connection;
import java.sql.DriverManager;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicReference;

public class JDBCStoredProcedure2Test extends VertxTestBase {

protected JDBCClient client;

@Before
public void setUp() throws Exception {
super.setUp();
client = JDBCClient.createNonShared(vertx, config());
}

@After
public void after() throws Exception {
client.close();
super.after();
}

protected static JsonObject config() {
return new JsonObject()
.put("url", "jdbc:mysql://localhost/test")
.put("driver_class", "com.mysql.jdbc.Driver")
.put("user", "root")
.put("password", "mypassword");
}

@Test
public void testStoredProcedure1() {
connection().callWithParams("{call proc_test(?, ?)}", new JsonArray().add("zepinos"), new JsonArray().addNull().add("VARCHAR"), onSuccess(resultSet -> {
System.out.println(resultSet.toJson());
assertNotNull(resultSet);
assertEquals(1, resultSet.getResults().size());
testComplete();
}));

await();
}

private SQLConnection connection() {
CountDownLatch latch = new CountDownLatch(1);
AtomicReference<SQLConnection> ref = new AtomicReference<>();
client.getConnection(onSuccess(conn -> {
ref.set(conn);
latch.countDown();
}));

try {
latch.await();
} catch (InterruptedException e) {
throw new RuntimeException(e);
}

return ref.get();
}
}

Jonghwa Kim

unread,
Nov 27, 2015, 11:17:13 AM11/27/15
to vert.x
Forgive me for being late.

This is the
result of execution.

"C:\Program Files\Java\jdk1.8.0_45\bin\java" -Didea.launcher.port=7533 "-Didea.launcher.bin.path=C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\bin" -Dfile.encoding=x-windows-949 -classpath "C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\idea_rt.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\plugins\junit\lib\junit-rt.jar;C:\Program Files\Java\jdk1.8.0_45\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.8.0_45\jre\lib\deploy.jar;C:\Program Files\Java\jdk1.8.0_45\jre\lib\javaws.jar;C:\Program Files\Java\jdk1.8.0_45\jre\lib\jce.jar;C:\Program Files\Java\jdk1.8.0_45\jre\lib\jfr.jar;C:\Program Files\Java\jdk1.8.0_45\jre\lib\jfxswt.jar;C:\Program Files\Java\jdk1.8.0_45\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.8.0_45\jre\lib\management-agent.jar;C:\Program Files\Java\jdk1.8.0_45\jre\lib\plugin.jar;C:\Program Files\Java\jdk1.8.0_45\jre\lib\resources.jar;C:\Program Files\Java\jdk1.8.0_45\jre\lib\rt.jar;C:\Program Files\Java\jdk1.8.0_45\jre\lib\ext\access-bridge-64.jar;C:\Program Files\Java\jdk1.8.0_45\jre\lib\ext\cldrdata.jar;C:\Program Files\Java\jdk1.8.0_45\jre\lib\ext\dnsns.jar;C:\Program Files\Java\jdk1.8.0_45\jre\lib\ext\jaccess.jar;C:\Program Files\Java\jdk1.8.0_45\jre\lib\ext\jfxrt.jar;C:\Program Files\Java\jdk1.8.0_45\jre\lib\ext\localedata.jar;C:\Program Files\Java\jdk1.8.0_45\jre\lib\ext\nashorn.jar;C:\Program Files\Java\jdk1.8.0_45\jre\lib\ext\sunec.jar;C:\Program Files\Java\jdk1.8.0_45\jre\lib\ext\sunjce_provider.jar;C:\Program Files\Java\jdk1.8.0_45\jre\lib\ext\sunmscapi.jar;C:\Program Files\Java\jdk1.8.0_45\jre\lib\ext\sunpkcs11.jar;C:\Program Files\Java\jdk1.8.0_45\jre\lib\ext\zipfs.jar;D:\Develop\IdeaProjects\GoR-Server\GoR-GameServer-JPN\target\test-classes;D:\Develop\IdeaProjects\GoR-Server\GoR-GameServer-JPN\target\classes;D:\vertx-jdbc-client\vertx-jdbc-client\target\vertx-jdbc-client-3.2.0-SNAPSHOT.jar;D:\vertx-jdbc-client\vertx-jdbc-client\target\vertx-jdbc-client-3.2.0-SNAPSHOT-tests.jar;C:\Users\zepinos\.m2\repository\io\vertx\vertx-core\3.2.0-SNAPSHOT\vertx-core-3.2.0-20151127.131823-124.jar;C:\Users\zepinos\.m2\repository\io\netty\netty-common\4.0.33.Final\netty-common-4.0.33.Final.jar;C:\Users\zepinos\.m2\repository\io\netty\netty-buffer\4.0.33.Final\netty-buffer-4.0.33.Final.jar;C:\Users\zepinos\.m2\repository\io\netty\netty-transport\4.0.33.Final\netty-transport-4.0.33.Final.jar;C:\Users\zepinos\.m2\repository\io\netty\netty-handler\4.0.33.Final\netty-handler-4.0.33.Final.jar;C:\Users\zepinos\.m2\repository\io\netty\netty-codec\4.0.33.Final\netty-codec-4.0.33.Final.jar;C:\Users\zepinos\.m2\repository\io\netty\netty-codec-http\4.0.33.Final\netty-codec-http-4.0.33.Final.jar;C:\Users\zepinos\.m2\repository\com\fasterxml\jackson\core\jackson-core\2.6.1\jackson-core-2.6.1.jar;C:\Users\zepinos\.m2\repository\com\fasterxml\jackson\core\jackson-databind\2.6.1\jackson-databind-2.6.1.jar;C:\Users\zepinos\.m2\repository\com\fasterxml\jackson\core\jackson-annotations\2.6.0\jackson-annotations-2.6.0.jar;C:\Users\zepinos\.m2\repository\io\vertx\vertx-web\3.2.0-SNAPSHOT\vertx-web-3.2.0-20151127.132929-110.jar;C:\Users\zepinos\.m2\repository\io\vertx\vertx-auth-common\3.2.0-SNAPSHOT\vertx-auth-common-3.2.0-20151127.132348-134.jar;C:\Users\zepinos\.m2\repository\io\vertx\vertx-hazelcast\3.2.0-SNAPSHOT\vertx-hazelcast-3.2.0-20151127.135113-111.jar;C:\Users\zepinos\.m2\repository\com\hazelcast\hazelcast\3.5.2\hazelcast-3.5.2.jar;C:\Users\zepinos\.m2\repository\junit\junit\4.11\junit-4.11.jar;C:\Users\zepinos\.m2\repository\org\hamcrest\hamcrest-core\1.3\hamcrest-core-1.3.jar;C:\Users\zepinos\.m2\repository\io\vertx\vertx-core\3.2.0-SNAPSHOT\vertx-core-3.2.0-20151127.131823-124-tests.jar;C:\Users\zepinos\.m2\repository\c3p0\c3p0\0.9.1.2\c3p0-0.9.1.2.jar;C:\Users\zepinos\.m2\repository\io\vertx\vertx-sql-common\3.2.0-SNAPSHOT\vertx-sql-common-3.2.0-20151127.132652-121.jar;C:\Users\zepinos\.m2\repository\mysql\mysql-connector-java\5.1.37\mysql-connector-java-5.1.37.jar;C:\Users\zepinos\.m2\repository\org\apache\commons\commons-lang3\3.4\commons-lang3-3.4.jar;C:\Users\zepinos\.m2\repository\org\slf4j\slf4j-api\1.7.13\slf4j-api-1.7.13.jar;C:\Users\zepinos\.m2\repository\org\slf4j\slf4j-log4j12\1.7.13\slf4j-log4j12-1.7.13.jar;C:\Users\zepinos\.m2\repository\log4j\log4j\1.2.17\log4j-1.2.17.jar" com.intellij.rt.execution.application.AppMain com.intellij.rt.execution.junit.JUnitStarter -ideVersion5 io.vertx.ext.jdbc.JDBCStoredProcedure2Test
Starting test: JDBCStoredProcedure2Test#testStoredProcedure1
MLog clients using log4j logging.
Starting test: JDBCStoredProcedure2Test#testStoredProcedure1
Initializing c3p0-0.9.1.2 [built 21-May-2007 15:04:56; debug? true; trace: 10]
Initializing c3p0 pool... com.mchange.v2.c3p0.ComboPooledDataSource [ acquireIncrement -> 3, acquireRetryAttempts -> 30, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 0, connectionCustomizerClassName -> null, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, dataSourceName -> 1hge0wa9dkfp9701o6farf|134593bf, debugUnreturnedConnectionStackTraces -> false, description -> null, driverClass -> com.mysql.jdbc.Driver, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, identityToken -> 1hge0wa9dkfp9701o6farf|134593bf, idleConnectionTestPeriod -> 0, initialPoolSize -> 3, jdbcUrl -> jdbc:mysql://localhost:3306/db?autoReconnect=true&amp;characterEncoding=utf8&amp;useUnicode=true&amp;zeroDateTimeBehavior=convertToNull, maxAdministrativeTaskTime -> 0, maxConnectionAge -> 0, maxIdleTime -> 0, maxIdleTimeExcessConnections -> 0, maxPoolSize -> 15, maxStatements -> 0, maxStatementsPerConnection -> 0, minPoolSize -> 3, numHelperThreads -> 3, numThreadsAwaitingCheckoutDefaultUser -> 0, preferredTestQuery -> null, properties -> {user=******, password=******}, propertyCycle -> 0, testConnectionOnCheckin -> false, testConnectionOnCheckout -> false, unreturnedConnectionTimeout -> 0, usesTraditionalReflectiveProxies -> false ]
{"columnNames":["now(6)"],"numColumns":1,"numRows":1,"results":[["2015-11-27T15:54:25.231Z"]],"rows":[{"now(6)":"2015-11-27T15:54:25.231Z"}]}

Process finished with exit code 0


But, this result is not what I want.
Show the results of the following codes.



import java.sql.*;

/**
* Created by zepinos on 2015-11-28.
*/
public class Test {

public static void main(String[] args) throws Exception {

Class.forName("com.mysql.jdbc.Driver");
Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/db", "username", "mypasword");

CallableStatement cstmt = conn.prepareCall("call proc_test(?, ?)");
cstmt.setString(1, "zepinos");
cstmt.registerOutParameter(2, Types.VARCHAR);

ResultSet rs = cstmt.executeQuery();

rs.next();

System.out.println("Result : " + rs.getString(1));
System.out.println("OUT lastname varchar : " + cstmt.getString(2));

}

}

"C:\Program Files\Java\jdk1.8.0_45\bin\java" -Didea.launcher.port=7535 "-Didea.launcher.bin.path=C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\bin" -Dfile.encoding=x-windows-949 -classpath "C:\Program Files\Java\jdk1.8.0_45\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.8.0_45\jre\lib\deploy.jar;C:\Program Files\Java\jdk1.8.0_45\jre\lib\javaws.jar;C:\Program Files\Java\jdk1.8.0_45\jre\lib\jce.jar;C:\Program Files\Java\jdk1.8.0_45\jre\lib\jfr.jar;C:\Program Files\Java\jdk1.8.0_45\jre\lib\jfxswt.jar;C:\Program Files\Java\jdk1.8.0_45\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.8.0_45\jre\lib\management-agent.jar;C:\Program Files\Java\jdk1.8.0_45\jre\lib\plugin.jar;C:\Program Files\Java\jdk1.8.0_45\jre\lib\resources.jar;C:\Program Files\Java\jdk1.8.0_45\jre\lib\rt.jar;C:\Program Files\Java\jdk1.8.0_45\jre\lib\ext\access-bridge-64.jar;C:\Program Files\Java\jdk1.8.0_45\jre\lib\ext\cldrdata.jar;C:\Program Files\Java\jdk1.8.0_45\jre\lib\ext\dnsns.jar;C:\Program Files\Java\jdk1.8.0_45\jre\lib\ext\jaccess.jar;C:\Program Files\Java\jdk1.8.0_45\jre\lib\ext\jfxrt.jar;C:\Program Files\Java\jdk1.8.0_45\jre\lib\ext\localedata.jar;C:\Program Files\Java\jdk1.8.0_45\jre\lib\ext\nashorn.jar;C:\Program Files\Java\jdk1.8.0_45\jre\lib\ext\sunec.jar;C:\Program Files\Java\jdk1.8.0_45\jre\lib\ext\sunjce_provider.jar;C:\Program Files\Java\jdk1.8.0_45\jre\lib\ext\sunmscapi.jar;C:\Program Files\Java\jdk1.8.0_45\jre\lib\ext\sunpkcs11.jar;C:\Program Files\Java\jdk1.8.0_45\jre\lib\ext\zipfs.jar;D:\Develop\IdeaProjects\GoR-Server\GoR-GameServer-JPN\target\classes;D:\vertx-jdbc-client\vertx-jdbc-client\target\vertx-jdbc-client-3.2.0-SNAPSHOT.jar;D:\vertx-jdbc-client\vertx-jdbc-client\target\vertx-jdbc-client-3.2.0-SNAPSHOT-tests.jar;C:\Users\zepinos\.m2\repository\io\vertx\vertx-core\3.2.0-SNAPSHOT\vertx-core-3.2.0-20151127.131823-124.jar;C:\Users\zepinos\.m2\repository\io\netty\netty-common\4.0.33.Final\netty-common-4.0.33.Final.jar;C:\Users\zepinos\.m2\repository\io\netty\netty-buffer\4.0.33.Final\netty-buffer-4.0.33.Final.jar;C:\Users\zepinos\.m2\repository\io\netty\netty-transport\4.0.33.Final\netty-transport-4.0.33.Final.jar;C:\Users\zepinos\.m2\repository\io\netty\netty-handler\4.0.33.Final\netty-handler-4.0.33.Final.jar;C:\Users\zepinos\.m2\repository\io\netty\netty-codec\4.0.33.Final\netty-codec-4.0.33.Final.jar;C:\Users\zepinos\.m2\repository\io\netty\netty-codec-http\4.0.33.Final\netty-codec-http-4.0.33.Final.jar;C:\Users\zepinos\.m2\repository\com\fasterxml\jackson\core\jackson-core\2.6.1\jackson-core-2.6.1.jar;C:\Users\zepinos\.m2\repository\com\fasterxml\jackson\core\jackson-databind\2.6.1\jackson-databind-2.6.1.jar;C:\Users\zepinos\.m2\repository\com\fasterxml\jackson\core\jackson-annotations\2.6.0\jackson-annotations-2.6.0.jar;C:\Users\zepinos\.m2\repository\io\vertx\vertx-web\3.2.0-SNAPSHOT\vertx-web-3.2.0-20151127.132929-110.jar;C:\Users\zepinos\.m2\repository\io\vertx\vertx-auth-common\3.2.0-SNAPSHOT\vertx-auth-common-3.2.0-20151127.132348-134.jar;C:\Users\zepinos\.m2\repository\io\vertx\vertx-hazelcast\3.2.0-SNAPSHOT\vertx-hazelcast-3.2.0-20151127.135113-111.jar;C:\Users\zepinos\.m2\repository\com\hazelcast\hazelcast\3.5.2\hazelcast-3.5.2.jar;C:\Users\zepinos\.m2\repository\c3p0\c3p0\0.9.1.2\c3p0-0.9.1.2.jar;C:\Users\zepinos\.m2\repository\io\vertx\vertx-sql-common\3.2.0-SNAPSHOT\vertx-sql-common-3.2.0-20151127.132652-121.jar;C:\Users\zepinos\.m2\repository\mysql\mysql-connector-java\5.1.37\mysql-connector-java-5.1.37.jar;C:\Users\zepinos\.m2\repository\org\apache\commons\commons-lang3\3.4\commons-lang3-3.4.jar;C:\Users\zepinos\.m2\repository\org\slf4j\slf4j-api\1.7.13\slf4j-api-1.7.13.jar;C:\Users\zepinos\.m2\repository\org\slf4j\slf4j-log4j12\1.7.13\slf4j-log4j12-1.7.13.jar;C:\Users\zepinos\.m2\repository\log4j\log4j\1.2.17\log4j-1.2.17.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\idea_rt.jar" com.intellij.rt.execution.application.AppMain Test

Result : 2015-11-28 01:10:50.3323
OUT lastname varchar : zepinos!!!

Process finished with exit code 0


I Want get both "Result" & "OUT lastname varchar"...


Thanks for the help so far.
zepinos.



2015년 11월 27일 금요일 오후 7시 6분 33초 UTC+9, Paulo Lopes 님의 말:

Jonghwa Kim

unread,
Nov 27, 2015, 1:02:38 PM11/27/15
to vert.x
JDBCCallable.java

     
boolean res = statement.execute();

     
if (res) {
       
// there is a resultSet
       
try (ResultSet rs = statement.getResultSet()) {
         
return asList(rs);
       
}
     
} else {
       
// there were registered outputs
       
if (out != null && out.size() > 0) {
         
List<JsonArray> results = new ArrayList<>();
         
JsonArray result = new JsonArray();

         
// one line resultSet
          results
.add(result);

         
for (int i = 0; i < out.size(); i++) {
           
Object var = out.getValue(i);
     
...
     
...
     
...





The above code whether to be modified as follows?


     
 boolean res = statement.execute();

     
List<JsonArray> results = new ArrayList<>();
     
if (res) {
       
// there is a resultSet
       
try (ResultSet rs = statement.getResultSet()) {
          results
.add(asList(rs));
       
}
     
} else {
       
JsonArray result = new JsonArray();

       
// one line resultSet
        results
.add(result);
     
}

     
// there were registered outputs
     
if (out != null && out.size() > 0) {
         
for (int i = 0; i < out.size(); i++) {
           
Object var = out.getValue(i);
     
...
     
...
     
...

Paulo Lopes

unread,
Nov 28, 2015, 4:17:25 AM11/28/15
to vert.x
I'm tracking it here:

https://github.com/vert-x3/vertx-jdbc-client/issues/36

I'll work on it ASAP so we can make it on 3.2

Jonghwa Kim

unread,
Dec 1, 2015, 4:44:07 AM12/1/15
to vert.x
It applies well as a snapshot version.

Looking forward to the release.


zepinos.
Reply all
Reply to author
Forward
0 new messages