In statement implementation

26 views
Skip to first unread message

Laputa

unread,
Oct 20, 2016, 11:25:27 PM10/20/16
to vert.x
I tried to do some query to mysql using vertx jdbc client but i never make  "IN"clause works in query... how i do that
here is my code:

client.getConnection(c->{
      if(c.succeeded()){
             c.updateWithParams("delete from some_table where some_key in ?",new JsonArray().add(new JsonArray().add(1).add(2)),h->{
                   /** get update result .... its only remove one 
             });
      }
});

is my code wrong or someting ?
please implements this in JDBCStatementHelper#fillStatement(PreparedStatement statement, JsonArray in)

Paulo Lopes

unread,
Oct 21, 2016, 3:16:25 AM10/21/16
to vert.x
The issue is that JDBC arrays are not currently supported due to the fact that JDBC requires type metadata in order to create an array, you can however solve your issue at the sql level:

c.updateWithParams("delete from some_table where some_key in (?, ?)", new JsonArray().add(1).add(2), h-> { ... });

Laputa

unread,
Oct 21, 2016, 3:23:36 AM10/21/16
to vert.x
OK then i think i must do like that, thanks 
Reply all
Reply to author
Forward
0 new messages