Package io.vertx.reactivex.ext.sql
Class SQLClient
- java.lang.Object
-
- io.vertx.reactivex.ext.sql.SQLClient
-
- All Implemented Interfaces:
SQLOperations
- Direct Known Subclasses:
JDBCClient
public class SQLClient extends Object implements SQLOperations
A common asynchronous client interface for interacting with SQL compliant database NOTE: This class has been automatically generated from theoriginalnon RX-ified interface using Vert.x codegen.
-
-
Field Summary
Fields Modifier and Type Field Description static TypeArg<SQLClient>__TYPE_ARG
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description SQLClientcall(String sql)Calls the given SQLPROCEDUREwhich returns the result from the procedure.SQLClientcall(String sql, Handler<AsyncResult<ResultSet>> handler)Calls the given SQLPROCEDUREwhich returns the result from the procedure.SQLClientcallWithParams(String sql, JsonArray params, JsonArray outputs)Calls the given SQLPROCEDUREwhich returns the result from the procedure.SQLClientcallWithParams(String sql, JsonArray params, JsonArray outputs, Handler<AsyncResult<ResultSet>> handler)Calls the given SQLPROCEDUREwhich returns the result from the procedure.voidclose()Close the clientvoidclose(Handler<AsyncResult<Void>> handler)Close the client and release all resources.booleanequals(Object o)SQLClientgetConnection()Returns a connection that can be used to perform SQL operations on.SQLClientgetConnection(Handler<AsyncResult<SQLConnection>> handler)Returns a connection that can be used to perform SQL operations on.SQLClientgetDelegate()inthashCode()static SQLClientnewInstance(SQLClient arg)SQLClientquery(String sql)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.SQLClientquery(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.SQLOperationsquerySingle(String sql)Execute a one shot SQL statement that returns a single SQL row.SQLOperationsquerySingle(String sql, Handler<AsyncResult<JsonArray>> handler)Execute a one shot SQL statement that returns a single SQL row.SQLOperationsquerySingleWithParams(String sql, JsonArray arguments)Execute a one shot SQL statement with arguments that returns a single SQL row.SQLOperationsquerySingleWithParams(String sql, JsonArray arguments, Handler<AsyncResult<JsonArray>> handler)Execute a one shot SQL statement with arguments that returns a single SQL row.SQLClientqueryStream(String sql)Executes the given SQLSELECTstatement which returns the results of the query as a read stream.SQLClientqueryStream(String sql, Handler<AsyncResult<SQLRowStream>> handler)Executes the given SQLSELECTstatement which returns the results of the query as a read stream.SQLClientqueryStreamWithParams(String sql, JsonArray params)Executes the given SQLSELECTstatement which returns the results of the query as a read stream.SQLClientqueryStreamWithParams(String sql, JsonArray params, Handler<AsyncResult<SQLRowStream>> handler)Executes the given SQLSELECTstatement which returns the results of the query as a read stream.SQLClientqueryWithParams(String sql, JsonArray arguments)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.SQLClientqueryWithParams(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.io.reactivex.Single<ResultSet>rxCall(String sql)Calls the given SQLPROCEDUREwhich returns the result from the procedure.io.reactivex.Single<ResultSet>rxCallWithParams(String sql, JsonArray params, JsonArray outputs)Calls the given SQLPROCEDUREwhich returns the result from the procedure.io.reactivex.CompletablerxClose()Close the client and release all resources.io.reactivex.Single<SQLConnection>rxGetConnection()Returns a connection that can be used to perform SQL operations on.io.reactivex.Single<ResultSet>rxQuery(String sql)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.io.reactivex.Maybe<JsonArray>rxQuerySingle(String sql)Execute a one shot SQL statement that returns a single SQL row.io.reactivex.Maybe<JsonArray>rxQuerySingleWithParams(String sql, JsonArray arguments)Execute a one shot SQL statement with arguments that returns a single SQL row.io.reactivex.Single<SQLRowStream>rxQueryStream(String sql)Executes the given SQLSELECTstatement which returns the results of the query as a read stream.io.reactivex.Single<SQLRowStream>rxQueryStreamWithParams(String sql, JsonArray params)Executes the given SQLSELECTstatement which returns the results of the query as a read stream.io.reactivex.Single<ResultSet>rxQueryWithParams(String sql, JsonArray arguments)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.io.reactivex.Single<UpdateResult>rxUpdate(String sql)Executes the given SQL statement which may be anINSERT,UPDATE, orDELETEstatement.io.reactivex.Single<UpdateResult>rxUpdateWithParams(String sql, JsonArray params)Executes the given prepared statement which may be anINSERT,UPDATE, orDELETEstatement with the given parametersStringtoString()SQLClientupdate(String sql)Executes the given SQL statement which may be anINSERT,UPDATE, orDELETEstatement.SQLClientupdate(String sql, Handler<AsyncResult<UpdateResult>> handler)Executes the given SQL statement which may be anINSERT,UPDATE, orDELETEstatement.SQLClientupdateWithParams(String sql, JsonArray params)Executes the given prepared statement which may be anINSERT,UPDATE, orDELETEstatement with the given parametersSQLClientupdateWithParams(String sql, JsonArray params, Handler<AsyncResult<UpdateResult>> handler)Executes the given prepared statement which may be anINSERT,UPDATE, orDELETEstatement with the given parameters
-
-
-
Method Detail
-
getDelegate
public SQLClient getDelegate()
- Specified by:
getDelegatein interfaceSQLOperations
-
querySingle
public SQLOperations querySingle(String sql, Handler<AsyncResult<JsonArray>> handler)
Execute a one shot SQL statement that returns a single SQL row. This method will reduce the boilerplate code by getting a connection from the pool (this object) and return it back after the execution. Only the first result from the result set is returned.- Specified by:
querySinglein interfaceSQLOperations- Parameters:
sql- the statement to executehandler- the result handler- Returns:
- self
-
querySingle
public SQLOperations querySingle(String sql)
Execute a one shot SQL statement that returns a single SQL row. This method will reduce the boilerplate code by getting a connection from the pool (this object) and return it back after the execution. Only the first result from the result set is returned.- Specified by:
querySinglein interfaceSQLOperations- Parameters:
sql- the statement to execute- Returns:
- self
-
rxQuerySingle
public io.reactivex.Maybe<JsonArray> rxQuerySingle(String sql)
Execute a one shot SQL statement that returns a single SQL row. This method will reduce the boilerplate code by getting a connection from the pool (this object) and return it back after the execution. Only the first result from the result set is returned.- Specified by:
rxQuerySinglein interfaceSQLOperations- Parameters:
sql- the statement to execute- Returns:
- self
-
querySingleWithParams
public SQLOperations querySingleWithParams(String sql, JsonArray arguments, Handler<AsyncResult<JsonArray>> handler)
Execute a one shot SQL statement with arguments that returns a single SQL row. This method will reduce the boilerplate code by getting a connection from the pool (this object) and return it back after the execution. Only the first result from the result set is returned.- Specified by:
querySingleWithParamsin interfaceSQLOperations- Parameters:
sql- the statement to executearguments- the argumentshandler- the result handler- Returns:
- self
-
querySingleWithParams
public SQLOperations querySingleWithParams(String sql, JsonArray arguments)
Execute a one shot SQL statement with arguments that returns a single SQL row. This method will reduce the boilerplate code by getting a connection from the pool (this object) and return it back after the execution. Only the first result from the result set is returned.- Specified by:
querySingleWithParamsin interfaceSQLOperations- Parameters:
sql- the statement to executearguments- the arguments- Returns:
- self
-
rxQuerySingleWithParams
public io.reactivex.Maybe<JsonArray> rxQuerySingleWithParams(String sql, JsonArray arguments)
Execute a one shot SQL statement with arguments that returns a single SQL row. This method will reduce the boilerplate code by getting a connection from the pool (this object) and return it back after the execution. Only the first result from the result set is returned.- Specified by:
rxQuerySingleWithParamsin interfaceSQLOperations- Parameters:
sql- the statement to executearguments- the arguments- Returns:
- self
-
getConnection
public SQLClient getConnection(Handler<AsyncResult<SQLConnection>> handler)
Returns a connection that can be used to perform SQL operations on. It's important to remember to close the connection when you are done, so it is returned to the pool.- Parameters:
handler- the handler which is called when theJdbcConnectionobject is ready for use.- Returns:
-
getConnection
public SQLClient getConnection()
Returns a connection that can be used to perform SQL operations on. It's important to remember to close the connection when you are done, so it is returned to the pool.- Returns:
-
rxGetConnection
public io.reactivex.Single<SQLConnection> rxGetConnection()
Returns a connection that can be used to perform SQL operations on. It's important to remember to close the connection when you are done, so it is returned to the pool.- Returns:
-
close
public void close(Handler<AsyncResult<Void>> handler)
Close the client and release all resources. Call the handler when close is complete.- Parameters:
handler- the handler that will be called when close is complete
-
rxClose
public io.reactivex.Completable rxClose()
Close the client and release all resources. Call the handler when close is complete.- Returns:
-
close
public void close()
Close the client
-
query
public 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.- Specified by:
queryin interfaceSQLOperations- Parameters:
sql- the statement to executehandler- the result handler- Returns:
- self
-
query
public SQLClient query(String sql)
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.- Specified by:
queryin interfaceSQLOperations- Parameters:
sql- the statement to execute- Returns:
- self
-
rxQuery
public io.reactivex.Single<ResultSet> rxQuery(String sql)
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.- Specified by:
rxQueryin interfaceSQLOperations- Parameters:
sql- the statement to execute- Returns:
- self
-
queryStream
public SQLClient queryStream(String sql, Handler<AsyncResult<SQLRowStream>> handler)
Executes the given SQLSELECTstatement which returns the results of the query as a read stream.- Specified by:
queryStreamin interfaceSQLOperations- Parameters:
sql- the SQL to execute. For exampleSELECT * FROM table ....handler- the handler which is called once the operation completes. It will return aSQLRowStream.- Returns:
-
queryStream
public SQLClient queryStream(String sql)
Executes the given SQLSELECTstatement which returns the results of the query as a read stream.- Specified by:
queryStreamin interfaceSQLOperations- Parameters:
sql- the SQL to execute. For exampleSELECT * FROM table ....- Returns:
-
rxQueryStream
public io.reactivex.Single<SQLRowStream> rxQueryStream(String sql)
Executes the given SQLSELECTstatement which returns the results of the query as a read stream.- Specified by:
rxQueryStreamin interfaceSQLOperations- Parameters:
sql- the SQL to execute. For exampleSELECT * FROM table ....- Returns:
-
queryStreamWithParams
public SQLClient queryStreamWithParams(String sql, JsonArray params, Handler<AsyncResult<SQLRowStream>> handler)
Executes the given SQLSELECTstatement which returns the results of the query as a read stream.- Specified by:
queryStreamWithParamsin interfaceSQLOperations- Parameters:
sql- the SQL to execute. For exampleSELECT * FROM table ....params- these are the parameters to fill the statement.handler- the handler which is called once the operation completes. It will return aSQLRowStream.- Returns:
-
queryStreamWithParams
public SQLClient queryStreamWithParams(String sql, JsonArray params)
Executes the given SQLSELECTstatement which returns the results of the query as a read stream.- Specified by:
queryStreamWithParamsin interfaceSQLOperations- Parameters:
sql- the SQL to execute. For exampleSELECT * FROM table ....params- these are the parameters to fill the statement.- Returns:
-
rxQueryStreamWithParams
public io.reactivex.Single<SQLRowStream> rxQueryStreamWithParams(String sql, JsonArray params)
Executes the given SQLSELECTstatement which returns the results of the query as a read stream.- Specified by:
rxQueryStreamWithParamsin interfaceSQLOperations- Parameters:
sql- the SQL to execute. For exampleSELECT * FROM table ....params- these are the parameters to fill the statement.- Returns:
-
queryWithParams
public 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.- Specified by:
queryWithParamsin interfaceSQLOperations- Parameters:
sql- the statement to executearguments- the arguments to the statementhandler- the result handler- Returns:
- self
-
queryWithParams
public SQLClient queryWithParams(String sql, JsonArray arguments)
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.- Specified by:
queryWithParamsin interfaceSQLOperations- Parameters:
sql- the statement to executearguments- the arguments to the statement- Returns:
- self
-
rxQueryWithParams
public io.reactivex.Single<ResultSet> rxQueryWithParams(String sql, JsonArray arguments)
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.- Specified by:
rxQueryWithParamsin interfaceSQLOperations- Parameters:
sql- the statement to executearguments- the arguments to the statement- Returns:
- self
-
update
public SQLClient update(String sql, Handler<AsyncResult<UpdateResult>> handler)
Executes the given SQL statement which may be anINSERT,UPDATE, orDELETEstatement.- Specified by:
updatein interfaceSQLOperations- Parameters:
sql- the SQL to execute. For exampleINSERT INTO table ...handler- the handler which is called once the operation completes.- Returns:
-
update
public SQLClient update(String sql)
Executes the given SQL statement which may be anINSERT,UPDATE, orDELETEstatement.- Specified by:
updatein interfaceSQLOperations- Parameters:
sql- the SQL to execute. For exampleINSERT INTO table ...- Returns:
-
rxUpdate
public io.reactivex.Single<UpdateResult> rxUpdate(String sql)
Executes the given SQL statement which may be anINSERT,UPDATE, orDELETEstatement.- Specified by:
rxUpdatein interfaceSQLOperations- Parameters:
sql- the SQL to execute. For exampleINSERT INTO table ...- Returns:
-
updateWithParams
public SQLClient updateWithParams(String sql, JsonArray params, Handler<AsyncResult<UpdateResult>> handler)
Executes the given prepared statement which may be anINSERT,UPDATE, orDELETEstatement with the given parameters- Specified by:
updateWithParamsin interfaceSQLOperations- Parameters:
sql- the SQL to execute. For exampleINSERT INTO table ...params- these are the parameters to fill the statement.handler- the handler which is called once the operation completes.- Returns:
-
updateWithParams
public SQLClient updateWithParams(String sql, JsonArray params)
Executes the given prepared statement which may be anINSERT,UPDATE, orDELETEstatement with the given parameters- Specified by:
updateWithParamsin interfaceSQLOperations- Parameters:
sql- the SQL to execute. For exampleINSERT INTO table ...params- these are the parameters to fill the statement.- Returns:
-
rxUpdateWithParams
public io.reactivex.Single<UpdateResult> rxUpdateWithParams(String sql, JsonArray params)
Executes the given prepared statement which may be anINSERT,UPDATE, orDELETEstatement with the given parameters- Specified by:
rxUpdateWithParamsin interfaceSQLOperations- Parameters:
sql- the SQL to execute. For exampleINSERT INTO table ...params- these are the parameters to fill the statement.- Returns:
-
call
public SQLClient call(String sql, Handler<AsyncResult<ResultSet>> handler)
Calls the given SQLPROCEDUREwhich returns the result from the procedure.- Specified by:
callin interfaceSQLOperations- Parameters:
sql- the SQL to execute. For example{call getEmpName}.handler- the handler which is called once the operation completes. It will return aResultSet.- Returns:
-
call
public SQLClient call(String sql)
Calls the given SQLPROCEDUREwhich returns the result from the procedure.- Specified by:
callin interfaceSQLOperations- Parameters:
sql- the SQL to execute. For example{call getEmpName}.- Returns:
-
rxCall
public io.reactivex.Single<ResultSet> rxCall(String sql)
Calls the given SQLPROCEDUREwhich returns the result from the procedure.- Specified by:
rxCallin interfaceSQLOperations- Parameters:
sql- the SQL to execute. For example{call getEmpName}.- Returns:
-
callWithParams
public SQLClient callWithParams(String sql, JsonArray params, JsonArray outputs, Handler<AsyncResult<ResultSet>> handler)
Calls the given SQLPROCEDUREwhich 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"]
- Specified by:
callWithParamsin interfaceSQLOperations- Parameters:
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 aResultSet.- Returns:
-
callWithParams
public SQLClient callWithParams(String sql, JsonArray params, JsonArray outputs)
Calls the given SQLPROCEDUREwhich 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"]
- Specified by:
callWithParamsin interfaceSQLOperations- Parameters:
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.- Returns:
-
rxCallWithParams
public io.reactivex.Single<ResultSet> rxCallWithParams(String sql, JsonArray params, JsonArray outputs)
Calls the given SQLPROCEDUREwhich 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"]
- Specified by:
rxCallWithParamsin interfaceSQLOperations- Parameters:
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.- Returns:
-
-