Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[API improvement] Types of params of PreparedStatement in Query or Update #24

Closed
BillyYccc opened this issue Nov 20, 2017 · 3 comments
Closed

Comments

@BillyYccc
Copy link
Member

Status

Currently query or update in PgOperations use List<Object> to hold multiple params, API is something like this void query(String sql, List<Object> params, Handler<AsyncResult<ResultSet>> handler);
or void update(String sql, List<Object> params, Handler<AsyncResult<UpdateResult>> handler);

Motivation

As it's defined in vertx-sql-common, SQLOperations use JsonArray to hold mutiple params like SQLOperations queryWithParams(String sql, JsonArray params, Handler<AsyncResult<ResultSet>> resultHandler);
or SQLOperations updateWithParams(String sql, JsonArray params, Handler<AsyncResult<UpdateResult>> resultHandler);
It's better to keep consistency, is it right?

Apart from this, List<Object> is also not supported by Codegen when passing as input parameters, so the method has to be ignored by @GenIgnore. When using Rxi-fied API, there is no methods to take multiple params as one collection, users have to maintain a state of how many params they use and then choose which method to use, this is not convenient when facing dynamic SQLs.

Therefore is there any possibility to change this?

@vietj
Copy link
Member

vietj commented Nov 20, 2017

I think we should work out in vertx the ability to support List<Object> and use it

@vietj
Copy link
Member

vietj commented Dec 7, 2017

@BillyYccc the master has been updated to use a Tuple object that is now available in RxJava as well, would you mind to try it ?

@vietj vietj closed this as completed Dec 7, 2017
@BillyYccc
Copy link
Member Author

@vietj Thanks for your nicely effort, This works now!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants