Class: VertxSql::SQLConnection
- Inherits:
-
Object
- Object
- VertxSql::SQLConnection
- Includes:
- SQLOperations
- Defined in:
- /Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql/sql_connection.rb
Overview
Represents a connection to a SQL database
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)
-
- (self) batch(sqlStatements, handler) { ... }
Batch simple SQL strings and execute the batch where the async result contains a array of Integers.
-
- (self) batchCallableWithParams(sqlStatement, inArgs, outArgs, handler) { ... }
Batch a callable statement with all entries from the args list.
-
- (self) batchWithParams(sqlStatement, args, handler) { ... }
Batch a prepared statement with all entries from the args list.
-
- (self) call(sql, resultHandler) { ... }
Calls the given SQL PROCEDURE which returns the result from the procedure.
-
- (self) callWithParams(sql, params, outputs, resultHandler) { ... }
Calls the given SQL PROCEDURE which returns the result from the procedure.
-
- (void) close
Closes the connection.
-
- (self) commit(handler) { ... }
Commits all changes made since the previous commit/rollback.
-
- (self) execute(sql, resultHandler) { ... }
Executes the given SQL statement.
-
- (self) getTransactionIsolation(handler) { ... }
Attempts to return the transaction isolation level for this Connection object to the one given.
-
- (self) query(sql, resultHandler) { ... }
Executes the given SQL SELECT statement which returns the results of the query.
-
- (self) querySingle(sql, handler) { ... }
Execute a one shot SQL statement that returns a single SQL row.
-
- (self) querySingleWithParams(sql, arguments, handler) { ... }
Execute a one shot SQL statement with arguments that returns a single SQL row.
-
- (self) queryStream(sql, handler) { ... }
Executes the given SQL SELECT statement which returns the results of the query as a read stream.
-
- (self) queryStreamWithParams(sql, params, handler) { ... }
Executes the given SQL SELECT statement which returns the results of the query as a read stream.
-
- (self) queryWithParams(sql, params, resultHandler) { ... }
Executes the given SQL SELECT prepared statement which returns the results of the query.
-
- (self) rollback(handler) { ... }
Rolls back all changes made since the previous commit/rollback.
-
- (self) setAutoCommit(autoCommit, resultHandler) { ... }
Sets the auto commit flag for this connection.
-
- (self) setOptions(options)
Sets the desired options to be applied to the current connection when statements are executed.
-
- (self) setQueryTimeout(timeoutInSeconds)
Sets a connection wide query timeout.
-
- (self) setTransactionIsolation(isolation, handler) { ... }
Attempts to change the transaction isolation level for this Connection object to the one given.
-
- (self) update(sql, resultHandler) { ... }
Executes the given SQL statement which may be an INSERT, UPDATE, or DELETE statement.
-
- (self) updateWithParams(sql, params, resultHandler) { ... }
Executes the given prepared statement which may be an INSERT, UPDATE, or DELETE statement with the given parameters.
Class Method Details
+ (Boolean) accept?(obj)
21 22 23 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql/sql_connection.rb', line 21 def @@j_api_type.accept?(obj) obj.class == SQLConnection end |
+ (Object) j_api_type
30 31 32 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql/sql_connection.rb', line 30 def self.j_api_type @@j_api_type end |
+ (Object) j_class
33 34 35 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql/sql_connection.rb', line 33 def self.j_class Java::IoVertxExtSql::SQLConnection.java_class end |
+ (Object) unwrap(obj)
27 28 29 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql/sql_connection.rb', line 27 def @@j_api_type.unwrap(obj) obj.j_del end |
+ (Object) wrap(obj)
24 25 26 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql/sql_connection.rb', line 24 def @@j_api_type.wrap(obj) SQLConnection.new(obj) end |
Instance Method Details
- (self) batch(sqlStatements, handler) { ... }
Batch simple SQL strings and execute the batch where the async result contains a array of Integers.
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql/sql_connection.rb', line 132 def batch(*args) if args[0].class == Array && true if (block_given?) @j_del.java_method(:batch, [Java::JavaUtil::List.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0].map { |element| element },block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result.to_a.map { |elt| elt } : nil) } : promise) return self else promise = ::Vertx::Util::Utils.promise @j_del.java_method(:batch, [Java::JavaUtil::List.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0].map { |element| element },block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result.to_a.map { |elt| elt } : nil) } : promise) return ::Vertx::Util::Utils.safe_create(promise.future(),::Vertx::Future, nil) end end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling batch(#{args[0]})" end end |
- (self) batchCallableWithParams(sqlStatement, inArgs, outArgs, handler) { ... }
Batch a callable statement with all entries from the args list. Each entry is a batch.
The size of the lists inArgs and outArgs MUST be the equal.
The operation completes with the execution of the batch where the async result contains a array of Integers.
296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql/sql_connection.rb', line 296 def batch_callable_with_params(*args) if args[0].class == String && args[1].class == Array && args[2].class == Array && true if (block_given?) @j_del.java_method(:batchCallableWithParams, [Java::java.lang.String.java_class,Java::JavaUtil::List.java_class,Java::JavaUtil::List.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0],args[1].map { |element| ::Vertx::Util::Utils.to_json_array(element) },args[2].map { |element| ::Vertx::Util::Utils.to_json_array(element) },block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result.to_a.map { |elt| elt } : nil) } : promise) return self else promise = ::Vertx::Util::Utils.promise @j_del.java_method(:batchCallableWithParams, [Java::java.lang.String.java_class,Java::JavaUtil::List.java_class,Java::JavaUtil::List.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0],args[1].map { |element| ::Vertx::Util::Utils.to_json_array(element) },args[2].map { |element| ::Vertx::Util::Utils.to_json_array(element) },block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result.to_a.map { |elt| elt } : nil) } : promise) return ::Vertx::Util::Utils.safe_create(promise.future(),::Vertx::Future, nil) end end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling batch_callable_with_params(#{args[0]},#{args[1]},#{args[2]})" end end |
- (self) batchWithParams(sqlStatement, args, handler) { ... }
Batch a prepared statement with all entries from the args list. Each entry is a batch.
The operation completes with the execution of the batch where the async result contains a array of Integers.
320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql/sql_connection.rb', line 320 def batch_with_params(*args) if args[0].class == String && args[1].class == Array && true if (block_given?) @j_del.java_method(:batchWithParams, [Java::java.lang.String.java_class,Java::JavaUtil::List.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0],args[1].map { |element| ::Vertx::Util::Utils.to_json_array(element) },block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result.to_a.map { |elt| elt } : nil) } : promise) return self else promise = ::Vertx::Util::Utils.promise @j_del.java_method(:batchWithParams, [Java::java.lang.String.java_class,Java::JavaUtil::List.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0],args[1].map { |element| ::Vertx::Util::Utils.to_json_array(element) },block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result.to_a.map { |elt| elt } : nil) } : promise) return ::Vertx::Util::Utils.safe_create(promise.future(),::Vertx::Future, nil) end end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling batch_with_params(#{args[0]},#{args[1]})" end end |
- (self) call(sql, resultHandler) { ... }
Calls the given SQL
PROCEDURE
which returns the result from the procedure.
359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql/sql_connection.rb', line 359 def call(*args) if args[0].class == String && true if (block_given?) @j_del.java_method(:call, [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 ? ar.result != nil ? JSON.parse(ar.result.toJson.encode) : nil : nil) } : promise) return self else promise = ::Vertx::Util::Utils.promise @j_del.java_method(:call, [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 ? ar.result != nil ? JSON.parse(ar.result.toJson.encode) : nil : nil) } : promise) return ::Vertx::Util::Utils.safe_create(promise.future(),::Vertx::Future,::Vertx::Util::data_object_type(Java::IoVertxExtSql::ResultSet)) end end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling call(#{args[0]})" end end |
- (self) callWithParams(sql, params, outputs, resultHandler) { ... }
Calls the given SQL
PROCEDURE
which returns the result from the procedure.
The index of params and outputs are important for both arrays, for example when dealing with a prodecure that
takes the first 2 arguments as input values and the 3 arg as an output then the arrays should be like:
params = [VALUE1, VALUE2, null]
outputs = [null, null, "VARCHAR"]
414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql/sql_connection.rb', line 414 def call_with_params(*args) if args[0].class == String && args[1].class == Array && args[2].class == Array && true if (block_given?) @j_del.java_method(:callWithParams, [Java::java.lang.String.java_class,Java::IoVertxCoreJson::JsonArray.java_class,Java::IoVertxCoreJson::JsonArray.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0],::Vertx::Util::Utils.to_json_array(args[1]),::Vertx::Util::Utils.to_json_array(args[2]),block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result != nil ? JSON.parse(ar.result.toJson.encode) : nil : nil) } : promise) return self else promise = ::Vertx::Util::Utils.promise @j_del.java_method(:callWithParams, [Java::java.lang.String.java_class,Java::IoVertxCoreJson::JsonArray.java_class,Java::IoVertxCoreJson::JsonArray.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0],::Vertx::Util::Utils.to_json_array(args[1]),::Vertx::Util::Utils.to_json_array(args[2]),block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result != nil ? JSON.parse(ar.result.toJson.encode) : nil : nil) } : promise) return ::Vertx::Util::Utils.safe_create(promise.future(),::Vertx::Future,::Vertx::Util::data_object_type(Java::IoVertxExtSql::ResultSet)) end end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling call_with_params(#{args[0]},#{args[1]},#{args[2]})" end end |
- (void) close - (void) close(handler) { ... }
This method returns an undefined value.
Closes the connection. Important to always close the connection when you are done so it's returned to the pool.
500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql/sql_connection.rb', line 500 def close if !block_given? return @j_del.java_method(:close, []).call() elsif true if (block_given?) return @j_del.java_method(:close, [Java::IoVertxCore::Handler.java_class]).call(block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? nil : nil) } : promise) else promise = ::Vertx::Util::Utils.promise @j_del.java_method(:close, [Java::IoVertxCore::Handler.java_class]).call(block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? nil : nil) } : promise) return ::Vertx::Util::Utils.safe_create(promise.future(),::Vertx::Future, nil) end end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling close()" end end |
- (self) commit(handler) { ... }
Commits all changes made since the previous commit/rollback.
153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql/sql_connection.rb', line 153 def commit if true if (block_given?) @j_del.java_method(:commit, [Java::IoVertxCore::Handler.java_class]).call(block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? nil : nil) } : promise) return self else promise = ::Vertx::Util::Utils.promise @j_del.java_method(:commit, [Java::IoVertxCore::Handler.java_class]).call(block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? nil : nil) } : promise) return ::Vertx::Util::Utils.safe_create(promise.future(),::Vertx::Future, nil) end end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling commit()" end end |
- (self) execute(sql, resultHandler) { ... }
Executes the given SQL statement
270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql/sql_connection.rb', line 270 def execute(*args) if args[0].class == String && true if (block_given?) @j_del.java_method(:execute, [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 ? nil : nil) } : promise) return self else promise = ::Vertx::Util::Utils.promise @j_del.java_method(:execute, [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 ? nil : nil) } : promise) return ::Vertx::Util::Utils.safe_create(promise.future(),::Vertx::Future, nil) end end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling execute(#{args[0]})" end end |
- (self) getTransactionIsolation(handler) { ... }
Attempts to return the transaction isolation level for this Connection object to the one given.
457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql/sql_connection.rb', line 457 def get_transaction_isolation if true if (block_given?) @j_del.java_method(:getTransactionIsolation, [Java::IoVertxCore::Handler.java_class]).call(nil) return self else promise = ::Vertx::Util::Utils.promise @j_del.java_method(:getTransactionIsolation, [Java::IoVertxCore::Handler.java_class]).call(nil) return ::Vertx::Util::Utils.safe_create(promise.future(),::Vertx::Future,::Vertx::Util::java_enum_type(Java::IoVertxExtSql::TransactionIsolation)) end end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling get_transaction_isolation()" end end |
- (self) query(sql, resultHandler) { ... }
Executes the given SQL
SELECT
statement which returns the results of the query.
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql/sql_connection.rb', line 110 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 ? ar.result != nil ? JSON.parse(ar.result.toJson.encode) : nil : 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 ? ar.result != nil ? JSON.parse(ar.result.toJson.encode) : nil : nil) } : promise) return ::Vertx::Util::Utils.safe_create(promise.future(),::Vertx::Future,::Vertx::Util::data_object_type(Java::IoVertxExtSql::ResultSet)) end end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling query(#{args[0]})" end end |
- (self) querySingle(sql, handler) { ... }
Execute a one shot SQL statement that returns a single SQL row. This method will reduce the boilerplate code by
getting a connection from the pool (this object) and return it back after the execution. Only the first result
from the result set is returned.
177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql/sql_connection.rb', line 177 def query_single(*args) if args[0].class == String && true if (block_given?) @j_del.java_method(:querySingle, [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 ? ar.result != nil ? JSON.parse(ar.result.encode) : nil : nil) } : promise) return self else promise = ::Vertx::Util::Utils.promise @j_del.java_method(:querySingle, [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 ? ar.result != nil ? JSON.parse(ar.result.encode) : nil : nil) } : promise) return ::Vertx::Util::Utils.safe_create(promise.future(),::Vertx::Future, nil) end end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling query_single(#{args[0]})" end end |
- (self) querySingleWithParams(sql, arguments, handler) { ... }
Execute a one shot SQL statement with arguments that returns a single SQL row. This method will reduce the
boilerplate code by getting a connection from the pool (this object) and return it back after the execution.
Only the first result from the result set is returned.
225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql/sql_connection.rb', line 225 def query_single_with_params(*args) if args[0].class == String && args[1].class == Array && true if (block_given?) @j_del.java_method(:querySingleWithParams, [Java::java.lang.String.java_class,Java::IoVertxCoreJson::JsonArray.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0],::Vertx::Util::Utils.to_json_array(args[1]),block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result != nil ? JSON.parse(ar.result.encode) : nil : nil) } : promise) return self else promise = ::Vertx::Util::Utils.promise @j_del.java_method(:querySingleWithParams, [Java::java.lang.String.java_class,Java::IoVertxCoreJson::JsonArray.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0],::Vertx::Util::Utils.to_json_array(args[1]),block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result != nil ? JSON.parse(ar.result.encode) : nil : nil) } : promise) return ::Vertx::Util::Utils.safe_create(promise.future(),::Vertx::Future, nil) end end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling query_single_with_params(#{args[0]},#{args[1]})" end end |
- (self) queryStream(sql, handler) { ... }
Executes the given SQL
SELECT
statement which returns the results of the query as a read stream.
523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql/sql_connection.rb', line 523 def query_stream(*args) if args[0].class == String && true if (block_given?) @j_del.java_method(:queryStream, [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,::VertxSql::SQLRowStream) : nil) } : promise) return self else promise = ::Vertx::Util::Utils.promise @j_del.java_method(:queryStream, [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,::VertxSql::SQLRowStream) : nil) } : promise) return ::Vertx::Util::Utils.safe_create(promise.future(),::Vertx::Future,::VertxSql::SQLRowStream.j_api_type) end end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling query_stream(#{args[0]})" end end |
- (self) queryStreamWithParams(sql, params, handler) { ... }
Executes the given SQL
SELECT
statement which returns the results of the query as a read stream.
248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql/sql_connection.rb', line 248 def query_stream_with_params(*args) if args[0].class == String && args[1].class == Array && true if (block_given?) @j_del.java_method(:queryStreamWithParams, [Java::java.lang.String.java_class,Java::IoVertxCoreJson::JsonArray.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0],::Vertx::Util::Utils.to_json_array(args[1]),block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxSql::SQLRowStream) : nil) } : promise) return self else promise = ::Vertx::Util::Utils.promise @j_del.java_method(:queryStreamWithParams, [Java::java.lang.String.java_class,Java::IoVertxCoreJson::JsonArray.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0],::Vertx::Util::Utils.to_json_array(args[1]),block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxSql::SQLRowStream) : nil) } : promise) return ::Vertx::Util::Utils.safe_create(promise.future(),::Vertx::Future,::VertxSql::SQLRowStream.j_api_type) end end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling query_stream_with_params(#{args[0]},#{args[1]})" end end |
- (self) queryWithParams(sql, params, resultHandler) { ... }
Executes the given SQL
SELECT
prepared statement which returns the results of the query.
382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql/sql_connection.rb', line 382 def query_with_params(*args) if args[0].class == String && args[1].class == Array && true if (block_given?) @j_del.java_method(:queryWithParams, [Java::java.lang.String.java_class,Java::IoVertxCoreJson::JsonArray.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0],::Vertx::Util::Utils.to_json_array(args[1]),block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result != nil ? JSON.parse(ar.result.toJson.encode) : nil : nil) } : promise) return self else promise = ::Vertx::Util::Utils.promise @j_del.java_method(:queryWithParams, [Java::java.lang.String.java_class,Java::IoVertxCoreJson::JsonArray.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0],::Vertx::Util::Utils.to_json_array(args[1]),block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result != nil ? JSON.parse(ar.result.toJson.encode) : nil : nil) } : promise) return ::Vertx::Util::Utils.safe_create(promise.future(),::Vertx::Future,::Vertx::Util::data_object_type(Java::IoVertxExtSql::ResultSet)) end end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling query_with_params(#{args[0]},#{args[1]})" end end |
- (self) rollback(handler) { ... }
Rolls back all changes made since the previous commit/rollback.
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql/sql_connection.rb', line 40 def rollback if true if (block_given?) @j_del.java_method(:rollback, [Java::IoVertxCore::Handler.java_class]).call(block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? nil : nil) } : promise) return self else promise = ::Vertx::Util::Utils.promise @j_del.java_method(:rollback, [Java::IoVertxCore::Handler.java_class]).call(block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? nil : nil) } : promise) return ::Vertx::Util::Utils.safe_create(promise.future(),::Vertx::Future, nil) end end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling rollback()" end end |
- (self) setAutoCommit(autoCommit, resultHandler) { ... }
Sets the auto commit flag for this connection. True by default.
436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql/sql_connection.rb', line 436 def set_auto_commit(*args) if (args[0].class == TrueClass || args[0].class == FalseClass) && true if (block_given?) @j_del.java_method(:setAutoCommit, [Java::boolean.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0],block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? nil : nil) } : promise) return self else promise = ::Vertx::Util::Utils.promise @j_del.java_method(:setAutoCommit, [Java::boolean.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0],block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? nil : nil) } : promise) return ::Vertx::Util::Utils.safe_create(promise.future(),::Vertx::Future, nil) end end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling set_auto_commit(#{args[0]})" end end |
- (self) setOptions(options)
Sets the desired options to be applied to the current connection when statements are executed.
The options are not applied globally but applicable to the current connection. For example changing the transaction
isolation level will only affect statements run on this connection and not future or current connections acquired
from the connection pool.
This method is not async in nature since the apply will only happen at the moment a query is run.
484 485 486 487 488 489 490 491 492 493 494 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql/sql_connection.rb', line 484 def (*args) if args[0].class == Hash && !block_given? @j_del.java_method(:setOptions, [Java::IoVertxExtSql::SQLOptions.java_class]).call(Java::IoVertxExtSql::SQLOptions.new(::Vertx::Util::Utils.to_json_object(args[0]))) return self end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling set_options(#{args[0]})" end end |
- (self) setQueryTimeout(timeoutInSeconds)
Sets a connection wide query timeout.
It can be over written at any time and becomes active on the next query call.
343 344 345 346 347 348 349 350 351 352 353 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql/sql_connection.rb', line 343 def set_query_timeout(*args) if args[0].class == Fixnum && !block_given? @j_del.java_method(:setQueryTimeout, [Java::int.java_class]).call(args[0]) return self end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling set_query_timeout(#{args[0]})" end end |
- (self) setTransactionIsolation(isolation, handler) { ... }
Attempts to change the transaction isolation level for this Connection object to the one given.
The constants defined in the interface Connection are the possible transaction isolation levels.
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql/sql_connection.rb', line 64 def set_transaction_isolation(*args) if args[0].class == Symbol && true if (block_given?) @j_del.java_method(:setTransactionIsolation, [Java::IoVertxExtSql::TransactionIsolation.java_class,Java::IoVertxCore::Handler.java_class]).call(Java::IoVertxExtSql::TransactionIsolation.valueOf(args[0].to_s),block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? nil : nil) } : promise) return self else promise = ::Vertx::Util::Utils.promise @j_del.java_method(:setTransactionIsolation, [Java::IoVertxExtSql::TransactionIsolation.java_class,Java::IoVertxCore::Handler.java_class]).call(Java::IoVertxExtSql::TransactionIsolation.valueOf(args[0].to_s),block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? nil : nil) } : promise) return ::Vertx::Util::Utils.safe_create(promise.future(),::Vertx::Future, nil) end end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling set_transaction_isolation(#{args[0]})" end end |
- (self) update(sql, resultHandler) { ... }
Executes the given SQL statement which may be an
INSERT
, UPDATE
, or DELETE
statement.
200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql/sql_connection.rb', line 200 def update(*args) if args[0].class == String && true if (block_given?) @j_del.java_method(:update, [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 ? ar.result != nil ? JSON.parse(ar.result.toJson.encode) : nil : nil) } : promise) return self else promise = ::Vertx::Util::Utils.promise @j_del.java_method(:update, [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 ? ar.result != nil ? JSON.parse(ar.result.toJson.encode) : nil : nil) } : promise) return ::Vertx::Util::Utils.safe_create(promise.future(),::Vertx::Future,::Vertx::Util::data_object_type(Java::IoVertxExtSql::UpdateResult)) end end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling update(#{args[0]})" end end |
- (self) updateWithParams(sql, params, resultHandler) { ... }
Executes the given prepared statement which may be an
INSERT
, UPDATE
, or DELETE
statement with the given parameters
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql/sql_connection.rb', line 88 def update_with_params(*args) if args[0].class == String && args[1].class == Array && true if (block_given?) @j_del.java_method(:updateWithParams, [Java::java.lang.String.java_class,Java::IoVertxCoreJson::JsonArray.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0],::Vertx::Util::Utils.to_json_array(args[1]),block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result != nil ? JSON.parse(ar.result.toJson.encode) : nil : nil) } : promise) return self else promise = ::Vertx::Util::Utils.promise @j_del.java_method(:updateWithParams, [Java::java.lang.String.java_class,Java::IoVertxCoreJson::JsonArray.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0],::Vertx::Util::Utils.to_json_array(args[1]),block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result != nil ? JSON.parse(ar.result.toJson.encode) : nil : nil) } : promise) return ::Vertx::Util::Utils.safe_create(promise.future(),::Vertx::Future,::Vertx::Util::data_object_type(Java::IoVertxExtSql::UpdateResult)) end end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling update_with_params(#{args[0]},#{args[1]})" end end |