public class JDBCClientImpl extends Object implements JDBCClient
DEFAULT_DS_NAME, DEFAULT_PROVIDER_CLASS| Constructor and Description |
|---|
JDBCClientImpl(Vertx vertx,
DataSource dataSource)
Create client with specific datasource.
|
JDBCClientImpl(Vertx vertx,
JsonObject config,
String datasourceName)
Create client with shared datasource.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close the client
|
void |
close(Handler<AsyncResult<Void>> completionHandler)
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.
|
JDBCClient |
query(String sql,
Handler<AsyncResult<ResultSet>> resultHandler)
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.
|
JDBCClient |
queryWithParams(String sql,
JsonArray in,
Handler<AsyncResult<ResultSet>> resultHandler)
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.
|
JDBCClient |
update(String sql,
Handler<AsyncResult<UpdateResult>> resultHandler)
Executes the given SQL statement which may be an
INSERT, UPDATE, or DELETE
statement. |
JDBCClient |
updateWithParams(String sql,
JsonArray in,
Handler<AsyncResult<UpdateResult>> resultHandler)
Executes the given prepared statement which may be an
INSERT, UPDATE, or DELETE
statement with the given parameters |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcreate, create, createNonShared, createShared, createSharedcall, callWithParams, queryStream, queryStreamWithParamsquerySingle, querySingleWithParamspublic JDBCClientImpl(Vertx vertx, DataSource dataSource)
public JDBCClientImpl(Vertx vertx, JsonObject config, String datasourceName)
public void close()
SQLClientpublic void close(Handler<AsyncResult<Void>> completionHandler)
SQLClientpublic JDBCClient update(String sql, Handler<AsyncResult<UpdateResult>> resultHandler)
SQLClientINSERT, UPDATE, or DELETE
statement.update in interface SQLClientupdate in interface SQLOperationssql - the SQL to execute. For example INSERT INTO table ...resultHandler - the handler which is called once the operation completes.Statement.executeUpdate(String),
Statement.executeUpdate(String)public JDBCClient updateWithParams(String sql, JsonArray in, Handler<AsyncResult<UpdateResult>> resultHandler)
SQLClientINSERT, UPDATE, or DELETE
statement with the given parametersupdateWithParams in interface SQLClientupdateWithParams in interface SQLOperationssql - the SQL to execute. For example INSERT INTO table ...in - these are the parameters to fill the statement.resultHandler - the handler which is called once the operation completes.Statement.executeUpdate(String),
Statement.executeUpdate(String)public JDBCClient query(String sql, Handler<AsyncResult<ResultSet>> resultHandler)
SQLClientquery in interface SQLClientquery in interface SQLOperationssql - the statement to executeresultHandler - the result handlerStatement.executeQuery(String),
Statement.executeQuery(String)public JDBCClient queryWithParams(String sql, JsonArray in, Handler<AsyncResult<ResultSet>> resultHandler)
SQLClientqueryWithParams in interface SQLClientqueryWithParams in interface SQLOperationssql - the statement to executein - the arguments to the statementresultHandler - the result handlerStatement.executeQuery(String),
Statement.executeQuery(String)public SQLClient getConnection(Handler<AsyncResult<SQLConnection>> handler)
SQLClientgetConnection in interface SQLClienthandler - the handler which is called when the JdbcConnection object is ready for use.Copyright © 2020. All rights reserved.