public interface SQLClient extends SQLOperations
Modifier and Type | Method and Description |
---|---|
default SQLClient |
call(String sql,
Handler<AsyncResult<ResultSet>> handler)
Calls the given SQL
PROCEDURE which returns the result from the procedure. |
default SQLClient |
callWithParams(String sql,
JsonArray params,
JsonArray outputs,
Handler<AsyncResult<ResultSet>> handler)
Calls the given SQL
PROCEDURE which returns the result from the procedure. |
void |
close()
Close the client
|
void |
close(Handler<AsyncResult<Void>> handler)
Close the client and release all resources.
|
SQLClient |
getConnection(Handler<AsyncResult<SQLConnection>> handler)
Returns a connection that can be used to perform SQL operations on.
|
default SQLClient |
query(String sql,
Handler<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 |
queryStream(String sql,
Handler<AsyncResult<SQLRowStream>> handler)
Executes the given SQL
SELECT statement which returns the results of the query as a read stream. |
default SQLClient |
queryStreamWithParams(String sql,
JsonArray params,
Handler<AsyncResult<SQLRowStream>> handler)
Executes the given SQL
SELECT statement which returns the results of the query as a read stream. |
default SQLClient |
queryWithParams(String sql,
JsonArray arguments,
Handler<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,
Handler<AsyncResult<UpdateResult>> handler)
Executes the given SQL statement which may be an
INSERT , UPDATE , or DELETE
statement. |
default SQLClient |
updateWithParams(String sql,
JsonArray params,
Handler<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(Handler<AsyncResult<SQLConnection>> handler)
handler
- the handler which is called when the JdbcConnection
object is ready for use.void close(Handler<AsyncResult<Void>> handler)
handler
- the handler that will be called when close is completevoid close()
default SQLClient query(String sql, Handler<AsyncResult<ResultSet>> handler)
query
in interface SQLOperations
sql
- the statement to executehandler
- the result handlerStatement.executeQuery(String)
,
Statement.executeQuery(String)
default SQLClient queryStream(String sql, Handler<AsyncResult<SQLRowStream>> handler)
SELECT
statement which returns the results of the query as a read stream.queryStream
in interface SQLOperations
sql
- the SQL to execute. For example SELECT * FROM table ...
.handler
- the handler which is called once the operation completes. It will return a SQLRowStream
.Statement.executeQuery(String)
,
Statement.executeQuery(String)
default SQLClient queryStreamWithParams(String sql, JsonArray params, Handler<AsyncResult<SQLRowStream>> handler)
SELECT
statement which returns the results of the query as a read stream.queryStreamWithParams
in interface SQLOperations
sql
- the SQL to execute. For example SELECT * FROM table ...
.params
- these are the parameters to fill the statement.handler
- the handler which is called once the operation completes. It will return a SQLRowStream
.Statement.executeQuery(String)
,
Statement.executeQuery(String)
default SQLClient queryWithParams(String sql, JsonArray arguments, Handler<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, Handler<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, JsonArray params, Handler<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, Handler<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, JsonArray params, JsonArray outputs, Handler<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 © 2021 Eclipse. All rights reserved.