Class: VertxSqlClient::SqlConnection
- Inherits:
-
SqlClient
- Object
- SqlClient
- VertxSqlClient::SqlConnection
show all
- Defined in:
- /Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql-client/sql_connection.rb
Overview
A connection to database server.
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/sql_connection.rb', line 25
def @@j_api_type.accept?(obj)
obj.class == SqlConnection
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/sql_connection.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/sql_connection.rb', line 37
def self.j_class
Java::IoVertxSqlclient::SqlConnection.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/sql_connection.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/sql_connection.rb', line 28
def @@j_api_type.wrap(obj)
SqlConnection.new(obj)
end
|
Instance Method Details
Begin a transaction and returns a
Transaction for controlling and tracking
this transaction.
When the connection is explicitely closed, any inflight transaction is rollbacked.
95
96
97
98
99
100
|
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql-client/sql_connection.rb', line 95
def begin
if !block_given?
return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:begin, []).call(),::VertxSqlClient::Transaction)
end
raise ArgumentError, "Invalid arguments when calling begin()"
end
|
- (void) close
This method returns an undefined value.
Close the current connection after all the pending commands have been processed.
110
111
112
113
114
115
|
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql-client/sql_connection.rb', line 110
def close
if !block_given?
return @j_del.java_method(:close, []).call()
end
raise ArgumentError, "Invalid arguments when calling close()"
end
|
- (self) close_handler { ... }
Set an handler called when the connection is closed.
83
84
85
86
87
88
89
|
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql-client/sql_connection.rb', line 83
def close_handler
if block_given?
@j_del.java_method(:closeHandler, [Java::IoVertxCore::Handler.java_class]).call(Proc.new { yield })
return self
end
raise ArgumentError, "Invalid arguments when calling close_handler()"
end
|
- (self) exception_handler { ... }
Set an handler called with connection errors.
73
74
75
76
77
78
79
|
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql-client/sql_connection.rb', line 73
def exception_handler
if block_given?
@j_del.java_method(:exceptionHandler, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(::Vertx::Util::Utils.from_throwable(event)) }))
return self
end
raise ArgumentError, "Invalid arguments when calling exception_handler()"
end
|
- (self) prepare(sql = nil) { ... }
63
64
65
66
67
68
69
|
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql-client/sql_connection.rb', line 63
def prepare(sql=nil)
if sql.class == String && block_given?
@j_del.java_method(:prepare, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(sql,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxSqlClient::PreparedStatement) : nil) }))
return self
end
raise ArgumentError, "Invalid arguments when calling prepare(#{sql})"
end
|
53
54
55
56
57
58
|
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql-client/sql_connection.rb', line 53
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
|
Create a query, the
Query#execute method must be called to execute the query.
43
44
45
46
47
48
|
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql-client/sql_connection.rb', line 43
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
|
- (true, false) ssl?
Returns whether the connection uses SSL
102
103
104
105
106
107
|
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql-client/sql_connection.rb', line 102
def ssl?
if !block_given?
return @j_del.java_method(:isSSL, []).call()
end
raise ArgumentError, "Invalid arguments when calling ssl?()"
end
|