public interface SQLClient extends SQLOperations
Modifier and Type | Method and Description |
---|---|
default SQLClient |
call(String sql,
io.vertx.core.Handler<io.vertx.core.AsyncResult<ResultSet>> handler)
Calls the given SQL
PROCEDURE which returns the result from the procedure. |
default SQLClient |
callWithParams(String sql,
io.vertx.core.json.JsonArray params,
io.vertx.core.json.JsonArray outputs,
io.vertx.core.Handler<io.vertx.core.AsyncResult<ResultSet>> handler)
Calls the given SQL
PROCEDURE which returns the result from the procedure. |
void |
close()
Close the client
|
void |
close(io.vertx.core.Handler<io.vertx.core.AsyncResult<Void>> handler)
Close the client and release all resources.
|
SQLClient |
getConnection(io.vertx.core.Handler<io.vertx.core.AsyncResult<SQLConnection>> handler)
Returns a connection that can be used to perform SQL operations on.
|
default SQLClient |
query(String sql,
io.vertx.core.Handler<io.vertx.core.AsyncResult<ResultSet>> handler)
Execute a single SQL statement, this method acquires a connection from the the pool and executes the SQL
statement and returns it back after the execution.
|
default SQLClient |
queryWithParams(String sql,
io.vertx.core.json.JsonArray arguments,
io.vertx.core.Handler<io.vertx.core.AsyncResult<ResultSet>> handler)
Execute a single SQL prepared statement, this method acquires a connection from the the pool and executes the SQL
prepared statement and returns it back after the execution.
|
default SQLClient |
update(String sql,
io.vertx.core.Handler<io.vertx.core.AsyncResult<UpdateResult>> handler)
Executes the given SQL statement which may be an
INSERT , UPDATE , or DELETE
statement. |
default SQLClient |
updateWithParams(String sql,
io.vertx.core.json.JsonArray params,
io.vertx.core.Handler<io.vertx.core.AsyncResult<UpdateResult>> handler)
Executes the given prepared statement which may be an
INSERT , UPDATE , or DELETE
statement with the given parameters |
querySingle, querySingleWithParams
SQLClient getConnection(io.vertx.core.Handler<io.vertx.core.AsyncResult<SQLConnection>> handler)
handler
- the handler which is called when the JdbcConnection
object is ready for use.void close(io.vertx.core.Handler<io.vertx.core.AsyncResult<Void>> handler)
handler
- the handler that will be called when close is completevoid close()
default SQLClient query(String sql, io.vertx.core.Handler<io.vertx.core.AsyncResult<ResultSet>> handler)
query
in interface SQLOperations
sql
- the statement to executehandler
- the result handlerStatement.executeQuery(String)
,
Statement.executeQuery(String)
default SQLClient queryWithParams(String sql, io.vertx.core.json.JsonArray arguments, io.vertx.core.Handler<io.vertx.core.AsyncResult<ResultSet>> handler)
queryWithParams
in interface SQLOperations
sql
- the statement to executearguments
- the arguments to the statementhandler
- the result handlerStatement.executeQuery(String)
,
Statement.executeQuery(String)
default SQLClient update(String sql, io.vertx.core.Handler<io.vertx.core.AsyncResult<UpdateResult>> handler)
INSERT
, UPDATE
, or DELETE
statement.update
in interface SQLOperations
sql
- the SQL to execute. For example INSERT INTO table ...
handler
- the handler which is called once the operation completes.Statement.executeUpdate(String)
,
Statement.executeUpdate(String)
default SQLClient updateWithParams(String sql, io.vertx.core.json.JsonArray params, io.vertx.core.Handler<io.vertx.core.AsyncResult<UpdateResult>> handler)
INSERT
, UPDATE
, or DELETE
statement with the given parametersupdateWithParams
in interface SQLOperations
sql
- the SQL to execute. For example INSERT INTO table ...
params
- these are the parameters to fill the statement.handler
- the handler which is called once the operation completes.Statement.executeUpdate(String)
,
Statement.executeUpdate(String)
default SQLClient call(String sql, io.vertx.core.Handler<io.vertx.core.AsyncResult<ResultSet>> handler)
PROCEDURE
which returns the result from the procedure.call
in interface SQLOperations
sql
- the SQL to execute. For example {call getEmpName}
.handler
- the handler which is called once the operation completes. It will return a ResultSet
.Statement.execute(String)
default SQLClient callWithParams(String sql, io.vertx.core.json.JsonArray params, io.vertx.core.json.JsonArray outputs, io.vertx.core.Handler<io.vertx.core.AsyncResult<ResultSet>> handler)
PROCEDURE
which returns the result from the procedure.
The index of params and outputs are important for both arrays, for example when dealing with a prodecure that
takes the first 2 arguments as input values and the 3 arg as an output then the arrays should be like:
params = [VALUE1, VALUE2, null] outputs = [null, null, "VARCHAR"]
callWithParams
in interface SQLOperations
sql
- the SQL to execute. For example {call getEmpName (?, ?)}
.params
- these are the parameters to fill the statement.outputs
- these are the outputs to fill the statement.handler
- the handler which is called once the operation completes. It will return a ResultSet
.Statement.execute(String)
Copyright © 2018 Eclipse. All rights reserved.