Class: VertxMysqlClient::MySQLConnection
- Inherits:
-
VertxSqlClient::SqlConnection
- Object
- VertxSqlClient::SqlClient
- VertxSqlClient::SqlConnection
- VertxMysqlClient::MySQLConnection
- Defined in:
- /Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mysql-client/my_sql_connection.rb
Overview
A connection to MySQL server.
Constant Summary
- @@j_api_type =
Object.new
Class Method Summary (collapse)
- + (Boolean) accept?(obj)
-
+ (void) connect(param_1 = nil, param_2 = nil)
Like #connect with options build from connectionUri.
- + (Object) j_api_type
- + (Object) j_class
- + (Object) unwrap(obj)
- + (Object) wrap(obj)
Instance Method Summary (collapse)
-
- (::VertxSqlClient::Transaction) begin
Begin a transaction and returns a for controlling and tracking this transaction.
-
- (self) change_user(options = nil) { ... }
Send a CHANGE_USER command to change the user of the current connection, this operation will also reset connection state.
-
- (void) close
Close the current connection after all the pending commands have been processed.
- - (self) close_handler { ... }
-
- (self) debug { ... }
Send a DEBUG command to dump debug information to the server's stdout.
- - (self) exception_handler { ... }
-
- (self) get_internal_statistics { ... }
Send a STATISTICS command to get a human readable string of the server internal status.
-
- (self) ping { ... }
Send a PING command to check if the server is alive.
- - (self) prepare(sql = nil) { ... }
- - (self) prepared_batch(sql = nil, batch = nil) { ... }
- - (self) prepared_query(sql = nil, arguments = nil) { ... }
- - (self) query(sql = nil) { ... }
-
- (self) reset_connection { ... }
Send a RESET_CONNECTION command to reset the session state.
-
- (self) set_option(option = nil) { ... }
Send a SET_OPTION command to set options for the current connection.
-
- (self) specify_schema(schemaName = nil) { ... }
Send a INIT_DB command to change the default schema of the connection.
-
- (true, false) ssl?
Whether the connection uses SSL.
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-mysql-client/my_sql_connection.rb', line 25 def @@j_api_type.accept?(obj) obj.class == MySQLConnection end |
+ (void) connect(vertx, connectOptions, handler) { ... } + (void) connect(vertx, connectionUri, handler) { ... }
This method returns an undefined value.
Like #connect with options build fromconnectionUri
.
87 88 89 90 91 92 93 94 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mysql-client/my_sql_connection.rb', line 87 def self.connect(param_1=nil,param_2=nil) if param_1.class.method_defined?(:j_del) && param_2.class == Hash && block_given? return Java::IoVertxMysqlclient::MySQLConnection.java_method(:connect, [Java::IoVertxCore::Vertx.java_class,Java::IoVertxMysqlclient::MySQLConnectOptions.java_class,Java::IoVertxCore::Handler.java_class]).call(param_1.j_del,Java::IoVertxMysqlclient::MySQLConnectOptions.new(::Vertx::Util::Utils.to_json_object(param_2)),(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxMysqlClient::MySQLConnection) : nil) })) elsif param_1.class.method_defined?(:j_del) && param_2.class == String && block_given? return Java::IoVertxMysqlclient::MySQLConnection.java_method(:connect, [Java::IoVertxCore::Vertx.java_class,Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(param_1.j_del,param_2,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxMysqlClient::MySQLConnection) : nil) })) end raise ArgumentError, "Invalid arguments when calling connect(#{param_1},#{param_2})" end |
+ (Object) j_api_type
34 35 36 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mysql-client/my_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-mysql-client/my_sql_connection.rb', line 37 def self.j_class Java::IoVertxMysqlclient::MySQLConnection.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-mysql-client/my_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-mysql-client/my_sql_connection.rb', line 28 def @@j_api_type.wrap(obj) MySQLConnection.new(obj) end |
Instance Method Details
- (::VertxSqlClient::Transaction) begin
Begin a transaction and returns a for controlling and tracking
this transaction.
When the connection is explicitely closed, any inflight transaction is rollbacked.
45 46 47 48 49 50 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mysql-client/my_sql_connection.rb', line 45 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 |
- (self) change_user(options = nil) { ... }
Send a CHANGE_USER command to change the user of the current connection, this operation will also reset connection state.
213 214 215 216 217 218 219 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mysql-client/my_sql_connection.rb', line 213 def change_user(=nil) if .class == Hash && block_given? @j_del.java_method(:changeUser, [Java::IoVertxMysqlclient::MySQLAuthOptions.java_class,Java::IoVertxCore::Handler.java_class]).call(Java::IoVertxMysqlclient::MySQLAuthOptions.new(::Vertx::Util::Utils.to_json_object()),(Proc.new { |ar| yield(ar.failed ? ar.cause : nil) })) return self end raise ArgumentError, "Invalid arguments when calling change_user(#{})" end |
- (void) close
This method returns an undefined value.
Close the current connection after all the pending commands have been processed.
60 61 62 63 64 65 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mysql-client/my_sql_connection.rb', line 60 def close if !block_given? return @j_del.java_method(:close, []).call() end raise ArgumentError, "Invalid arguments when calling close()" end |
- (self) close_handler { ... }
116 117 118 119 120 121 122 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mysql-client/my_sql_connection.rb', line 116 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) debug { ... }
Send a DEBUG command to dump debug information to the server's stdout.
202 203 204 205 206 207 208 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mysql-client/my_sql_connection.rb', line 202 def debug if block_given? @j_del.java_method(:debug, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |ar| yield(ar.failed ? ar.cause : nil) })) return self end raise ArgumentError, "Invalid arguments when calling debug()" end |
- (self) exception_handler { ... }
107 108 109 110 111 112 113 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mysql-client/my_sql_connection.rb', line 107 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) get_internal_statistics { ... }
Send a STATISTICS command to get a human readable string of the server internal status.
171 172 173 174 175 176 177 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mysql-client/my_sql_connection.rb', line 171 def get_internal_statistics if block_given? @j_del.java_method(:getInternalStatistics, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result : nil) })) return self end raise ArgumentError, "Invalid arguments when calling get_internal_statistics()" end |
- (self) ping { ... }
Send a PING command to check if the server is alive.
150 151 152 153 154 155 156 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mysql-client/my_sql_connection.rb', line 150 def ping if block_given? @j_del.java_method(:ping, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |ar| yield(ar.failed ? ar.cause : nil) })) return self end raise ArgumentError, "Invalid arguments when calling ping()" end |
- (self) prepare(sql = nil) { ... }
98 99 100 101 102 103 104 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mysql-client/my_sql_connection.rb', line 98 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::PreparedQuery) : nil) })) return self end raise ArgumentError, "Invalid arguments when calling prepare(#{sql})" end |
- (self) prepared_batch(sql = nil, batch = nil) { ... }
70 71 72 73 74 75 76 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mysql-client/my_sql_connection.rb', line 70 def prepared_batch(sql=nil,batch=nil) if sql.class == String && batch.class == Array && block_given? @j_del.java_method(:preparedBatch, [Java::java.lang.String.java_class,Java::JavaUtil::List.java_class,Java::IoVertxCore::Handler.java_class]).call(sql,batch.map { |element| element.j_del },(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) })) return self end raise ArgumentError, "Invalid arguments when calling prepared_batch(#{sql},#{batch})" end |
- (self) prepared_query(sql = nil, arguments = nil) { ... }
127 128 129 130 131 132 133 134 135 136 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mysql-client/my_sql_connection.rb', line 127 def prepared_query(sql=nil,arguments=nil) if sql.class == String && block_given? && arguments == nil @j_del.java_method(:preparedQuery, [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::RowSet,::VertxSqlClient::Row.j_api_type) : nil) })) return self elsif sql.class == String && arguments.class.method_defined?(:j_del) && block_given? @j_del.java_method(:preparedQuery, [Java::java.lang.String.java_class,Java::IoVertxSqlclient::Tuple.java_class,Java::IoVertxCore::Handler.java_class]).call(sql,arguments.j_del,(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) })) return self end raise ArgumentError, "Invalid arguments when calling prepared_query(#{sql},#{arguments})" end |
- (self) query(sql = nil) { ... }
140 141 142 143 144 145 146 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mysql-client/my_sql_connection.rb', line 140 def query(sql=nil) if sql.class == String && block_given? @j_del.java_method(:query, [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::RowSet,::VertxSqlClient::Row.j_api_type) : nil) })) return self end raise ArgumentError, "Invalid arguments when calling query(#{sql})" end |
- (self) reset_connection { ... }
Send a RESET_CONNECTION command to reset the session state.
192 193 194 195 196 197 198 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mysql-client/my_sql_connection.rb', line 192 def reset_connection if block_given? @j_del.java_method(:resetConnection, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |ar| yield(ar.failed ? ar.cause : nil) })) return self end raise ArgumentError, "Invalid arguments when calling reset_connection()" end |
- (self) set_option(option = nil) { ... }
Send a SET_OPTION command to set options for the current connection.
182 183 184 185 186 187 188 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mysql-client/my_sql_connection.rb', line 182 def set_option(option=nil) if option.class == Symbol && block_given? @j_del.java_method(:setOption, [Java::IoVertxMysqlclient::MySQLSetOption.java_class,Java::IoVertxCore::Handler.java_class]).call(Java::IoVertxMysqlclient::MySQLSetOption.valueOf(option.to_s),(Proc.new { |ar| yield(ar.failed ? ar.cause : nil) })) return self end raise ArgumentError, "Invalid arguments when calling set_option(#{option})" end |
- (self) specify_schema(schemaName = nil) { ... }
Send a INIT_DB command to change the default schema of the connection.
161 162 163 164 165 166 167 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mysql-client/my_sql_connection.rb', line 161 def specify_schema(schemaName=nil) if schemaName.class == String && block_given? @j_del.java_method(:specifySchema, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(schemaName,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil) })) return self end raise ArgumentError, "Invalid arguments when calling specify_schema(#{schemaName})" end |
- (true, false) ssl?
Returns whether the connection uses SSL
52 53 54 55 56 57 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mysql-client/my_sql_connection.rb', line 52 def ssl? if !block_given? return @j_del.java_method(:isSSL, []).call() end raise ArgumentError, "Invalid arguments when calling ssl?()" end |