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
Constant Summary
- @@j_api_type =
Object.new
Class Method Summary (collapse)
- + (Boolean) accept?(obj)
- + (Object) j_api_type
- + (Object) j_class
- + (Object) unwrap(obj)
- + (Object) wrap(obj)
Instance Method Summary (collapse)
-
- (void) begin(handler) { ... }
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) getConnection(handler) { ... }
Get a connection from the pool.
- - (self) preparedBatch(sql, batch, handler) { ... }
- - (self) prepared_query(*args)
- - (self) query(sql, handler) { ... }
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 |
+ (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(handler) { ... }
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.
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql-client/pool.rb', line 122 def begin if true if (block_given?) return @j_del.java_method(:begin, [Java::IoVertxCore::Handler.java_class]).call(block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxSqlClient::Transaction) : nil) } : promise) else promise = ::Vertx::Util::Utils.promise @j_del.java_method(:begin, [Java::IoVertxCore::Handler.java_class]).call(block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxSqlClient::Transaction) : nil) } : promise) return ::Vertx::Util::Utils.safe_create(promise.future(),::Vertx::Future,::VertxSqlClient::Transaction.j_api_type) end end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling begin()" end end |
- (void) close
This method returns an undefined value.
Close the pool and release the associated resources.
107 108 109 110 111 112 113 114 115 116 |
# 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 if defined?(super) super else raise ArgumentError, "Invalid arguments when calling close()" end end |
- (void) getConnection(handler) { ... }
This method returns an undefined value.
Get a connection from the pool.
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql-client/pool.rb', line 45 def get_connection if true if (block_given?) return @j_del.java_method(:getConnection, [Java::IoVertxCore::Handler.java_class]).call(block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxSqlClient::SqlConnection) : nil) } : promise) else promise = ::Vertx::Util::Utils.promise @j_del.java_method(:getConnection, [Java::IoVertxCore::Handler.java_class]).call(block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxSqlClient::SqlConnection) : nil) } : promise) return ::Vertx::Util::Utils.safe_create(promise.future(),::Vertx::Future,::VertxSqlClient::SqlConnection.j_api_type) end end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling get_connection()" end end |
- (self) preparedBatch(sql, batch, handler) { ... }
66 67 68 69 70 71 72 73 74 75 76 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 66 def prepared_batch(*args) if args[0].class == String && args[1].class == Array && true if (block_given?) @j_del.java_method(:preparedBatch, [Java::java.lang.String.java_class,Java::JavaUtil::List.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0],args[1].map { |element| element.j_del },block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxSqlClient::RowSet,::VertxSqlClient::Row.j_api_type) : nil) } : promise) return self else promise = ::Vertx::Util::Utils.promise @j_del.java_method(:preparedBatch, [Java::java.lang.String.java_class,Java::JavaUtil::List.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0],args[1].map { |element| element.j_del },block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxSqlClient::RowSet,::VertxSqlClient::Row.j_api_type) : nil) } : promise) return ::Vertx::Util::Utils.safe_create(promise.future(),::Vertx::Future,::VertxSqlClient::RowSet.j_api_type) end end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling prepared_batch(#{args[0]},#{args[1]})" end end |
- (self) preparedQuery(sql, handler) { ... } - (self) preparedQuery(sql, arguments, handler) { ... }
146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql-client/pool.rb', line 146 def prepared_query(*args) if args[0].class == String && true && args[1] == nil if (block_given?) @j_del.java_method(:preparedQuery, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0],block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxSqlClient::RowSet,::VertxSqlClient::Row.j_api_type) : nil) } : promise) return self else promise = ::Vertx::Util::Utils.promise @j_del.java_method(:preparedQuery, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0],block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxSqlClient::RowSet,::VertxSqlClient::Row.j_api_type) : nil) } : promise) return ::Vertx::Util::Utils.safe_create(promise.future(),::Vertx::Future,::VertxSqlClient::RowSet.j_api_type) end elsif args[0].class == String && args[1].class.method_defined?(:j_del) && true if (block_given?) @j_del.java_method(:preparedQuery, [Java::java.lang.String.java_class,Java::IoVertxSqlclient::Tuple.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0],args[1].j_del,block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxSqlClient::RowSet,::VertxSqlClient::Row.j_api_type) : nil) } : promise) return self else promise = ::Vertx::Util::Utils.promise @j_del.java_method(:preparedQuery, [Java::java.lang.String.java_class,Java::IoVertxSqlclient::Tuple.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0],args[1].j_del,block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxSqlClient::RowSet,::VertxSqlClient::Row.j_api_type) : nil) } : promise) return ::Vertx::Util::Utils.safe_create(promise.future(),::Vertx::Future,::VertxSqlClient::RowSet.j_api_type) end end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling prepared_query(#{args[0]},#{args[1]})" end end |
- (self) query(sql, handler) { ... }
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql-client/pool.rb', line 87 def query(*args) if args[0].class == String && true if (block_given?) @j_del.java_method(:query, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0],block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxSqlClient::RowSet,::VertxSqlClient::Row.j_api_type) : nil) } : promise) return self else promise = ::Vertx::Util::Utils.promise @j_del.java_method(:query, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0],block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxSqlClient::RowSet,::VertxSqlClient::Row.j_api_type) : nil) } : promise) return ::Vertx::Util::Utils.safe_create(promise.future(),::Vertx::Future,::VertxSqlClient::RowSet.j_api_type) end end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling query(#{args[0]})" end end |