Class: VertxSqlClient::Pool
- Inherits:
-
SqlClient
- Object
- SqlClient
- VertxSqlClient::Pool
- Defined in:
- /Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql-client/pool.rb
Overview
A pool of SQL connections.
Direct Known Subclasses
VertxDb2Client::DB2Pool, VertxMysqlClient::MySQLPool, VertxPgClient::PgPool
Constant Summary
- @@j_api_type =
Object.new
Class Method Summary (collapse)
- + (Boolean) accept?(obj)
- + (Object) j_api_type
- + (Object) j_class
-
+ (::VertxSqlClient::Pool) pool(param_1 = nil, param_2 = nil, param_3 = nil)
Create a connection pool to the database configured with the given connectOptions and poolOptions.
- + (Object) unwrap(obj)
- + (Object) wrap(obj)
Instance Method Summary (collapse)
-
- (void) begin { ... }
Borrow a connection from the pool and begin a transaction, the underlying connection will be returned to the pool when the transaction ends.
-
- (void) close
Close the pool and release the associated resources.
-
- (void) get_connection { ... }
Get a connection from the pool.
-
- (::VertxSqlClient::PreparedQuery) prepared_query(sql = nil)
A connection is borrowed from the connection pool when the query is executed and then immediately returned to the pool after it completes.
-
- (::VertxSqlClient::Query) query(sql = nil)
A connection is borrowed from the connection pool when the query is executed and then immediately returned to the pool after it completes.
Class Method Details
+ (Boolean) accept?(obj)
26 27 28 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql-client/pool.rb', line 26 def @@j_api_type.accept?(obj) obj.class == Pool end |
+ (Object) j_api_type
35 36 37 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql-client/pool.rb', line 35 def self.j_api_type @@j_api_type end |
+ (Object) j_class
38 39 40 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql-client/pool.rb', line 38 def self.j_class Java::IoVertxSqlclient::Pool.java_class end |
+ (::VertxSqlClient::Pool) pool(connectOptions) + (::VertxSqlClient::Pool) pool(connectOptions, poolOptions) + (::VertxSqlClient::Pool) pool(vertx, connectOptions, poolOptions)
Create a connection pool to the database configured with the given
connectOptions
and poolOptions
.
52 53 54 55 56 57 58 59 60 61 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql-client/pool.rb', line 52 def self.pool(param_1=nil,param_2=nil,param_3=nil) if param_1.class == Hash && !block_given? && param_2 == nil && param_3 == nil return ::Vertx::Util::Utils.safe_create(Java::IoVertxSqlclient::Pool.java_method(:pool, [Java::IoVertxSqlclient::SqlConnectOptions.java_class]).call(Java::IoVertxSqlclient::SqlConnectOptions.new(::Vertx::Util::Utils.to_json_object(param_1))),::VertxSqlClient::Pool) elsif param_1.class == Hash && param_2.class == Hash && !block_given? && param_3 == nil return ::Vertx::Util::Utils.safe_create(Java::IoVertxSqlclient::Pool.java_method(:pool, [Java::IoVertxSqlclient::SqlConnectOptions.java_class,Java::IoVertxSqlclient::PoolOptions.java_class]).call(Java::IoVertxSqlclient::SqlConnectOptions.new(::Vertx::Util::Utils.to_json_object(param_1)),Java::IoVertxSqlclient::PoolOptions.new(::Vertx::Util::Utils.to_json_object(param_2))),::VertxSqlClient::Pool) elsif param_1.class.method_defined?(:j_del) && param_2.class == Hash && param_3.class == Hash && !block_given? return ::Vertx::Util::Utils.safe_create(Java::IoVertxSqlclient::Pool.java_method(:pool, [Java::IoVertxCore::Vertx.java_class,Java::IoVertxSqlclient::SqlConnectOptions.java_class,Java::IoVertxSqlclient::PoolOptions.java_class]).call(param_1.j_del,Java::IoVertxSqlclient::SqlConnectOptions.new(::Vertx::Util::Utils.to_json_object(param_2)),Java::IoVertxSqlclient::PoolOptions.new(::Vertx::Util::Utils.to_json_object(param_3))),::VertxSqlClient::Pool) end raise ArgumentError, "Invalid arguments when calling pool(#{param_1},#{param_2},#{param_3})" end |
+ (Object) unwrap(obj)
32 33 34 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql-client/pool.rb', line 32 def @@j_api_type.unwrap(obj) obj.j_del end |
+ (Object) wrap(obj)
29 30 31 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql-client/pool.rb', line 29 def @@j_api_type.wrap(obj) Pool.new(obj) end |
Instance Method Details
- (void) begin { ... }
This method returns an undefined value.
Borrow a connection from the pool and begin a transaction, the underlying connection will be returned to the pool when the transaction ends.
99 100 101 102 103 104 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql-client/pool.rb', line 99 def begin if block_given? return @j_del.java_method(:begin, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxSqlClient::Transaction) : nil) })) end raise ArgumentError, "Invalid arguments when calling begin()" end |
- (void) close
This method returns an undefined value.
Close the pool and release the associated resources.
107 108 109 110 111 112 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql-client/pool.rb', line 107 def close if !block_given? return @j_del.java_method(:close, []).call() end raise ArgumentError, "Invalid arguments when calling close()" end |
- (void) get_connection { ... }
This method returns an undefined value.
Get a connection from the pool.
65 66 67 68 69 70 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql-client/pool.rb', line 65 def get_connection if block_given? return @j_del.java_method(:getConnection, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxSqlClient::SqlConnection) : nil) })) end raise ArgumentError, "Invalid arguments when calling get_connection()" end |
- (::VertxSqlClient::PreparedQuery) prepared_query(sql = nil)
A connection is borrowed from the connection pool when the query is executed and then immediately returned
to the pool after it completes.
89 90 91 92 93 94 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql-client/pool.rb', line 89 def prepared_query(sql=nil) if sql.class == String && !block_given? return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:preparedQuery, [Java::java.lang.String.java_class]).call(sql),::VertxSqlClient::PreparedQuery,::VertxSqlClient::RowSet.j_api_type) end raise ArgumentError, "Invalid arguments when calling prepared_query(#{sql})" end |
- (::VertxSqlClient::Query) query(sql = nil)
A connection is borrowed from the connection pool when the query is executed and then immediately returned
to the pool after it completes.
77 78 79 80 81 82 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql-client/pool.rb', line 77 def query(sql=nil) if sql.class == String && !block_given? return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:query, [Java::java.lang.String.java_class]).call(sql),::VertxSqlClient::Query,::VertxSqlClient::RowSet.j_api_type) end raise ArgumentError, "Invalid arguments when calling query(#{sql})" end |