Class: VertxSqlClient::Pool
- Inherits:
-
SqlClient
show all
- 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.
Constant Summary
- @@j_api_type =
Object.new
Class Method Summary
(collapse)
Instance Method Summary
(collapse)
Class Method Details
+ (Boolean) accept?(obj)
25
26
27
|
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql-client/pool.rb', line 25
def @@j_api_type.accept?(obj)
obj.class == Pool
end
|
+ (Object) j_api_type
34
35
36
|
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql-client/pool.rb', line 34
def self.j_api_type
@@j_api_type
end
|
+ (Object) j_class
37
38
39
|
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql-client/pool.rb', line 37
def self.j_class
Java::IoVertxSqlclient::Pool.java_class
end
|
+ (Object) unwrap(obj)
31
32
33
|
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql-client/pool.rb', line 31
def @@j_api_type.unwrap(obj)
obj.j_del
end
|
+ (Object) wrap(obj)
28
29
30
|
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql-client/pool.rb', line 28
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.
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 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.
85
86
87
88
89
90
|
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql-client/pool.rb', line 85
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.
43
44
45
46
47
48
|
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql-client/pool.rb', line 43
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
|
A connection is borrowed from the connection pool when the query is executed and then immediately returned
to the pool after it completes.
67
68
69
70
71
72
|
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql-client/pool.rb', line 67
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
|
A connection is borrowed from the connection pool when the query is executed and then immediately returned
to the pool after it completes.
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 55
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
|