Class: VertxSql::SQLConnection

Inherits:
Object
  • Object
show all
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)

Instance Method Summary (collapse)

Class Method Details

+ (Boolean) accept?(obj)

Returns:

  • (Boolean)


20
21
22
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql/sql_connection.rb', line 20

def @@j_api_type.accept?(obj)
  obj.class == SQLConnection
end

+ (Object) j_api_type



29
30
31
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql/sql_connection.rb', line 29

def self.j_api_type
  @@j_api_type
end

+ (Object) j_class



32
33
34
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql/sql_connection.rb', line 32

def self.j_class
  Java::IoVertxExtSql::SQLConnection.java_class
end

+ (Object) unwrap(obj)



26
27
28
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql/sql_connection.rb', line 26

def @@j_api_type.unwrap(obj)
  obj.j_del
end

+ (Object) wrap(obj)



23
24
25
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql/sql_connection.rb', line 23

def @@j_api_type.wrap(obj)
  SQLConnection.new(obj)
end

Instance Method Details

- (self) batch(sqlStatements = nil) { ... }

Batch simple SQL strings and execute the batch where the async result contains a array of Integers.

Parameters:

  • sqlStatements (Array<String>) (defaults to: nil)
    sql statement

Yields:

  • the result handler

Returns:

  • (self)

Raises:

  • (ArgumentError)


250
251
252
253
254
255
256
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql/sql_connection.rb', line 250

def batch(sqlStatements=nil)
  if sqlStatements.class == Array && block_given?
    @j_del.java_method(:batch, [Java::JavaUtil::List.java_class,Java::IoVertxCore::Handler.java_class]).call(sqlStatements.map { |element| element },(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result.to_a.map { |elt| elt } : nil) }))
    return self
  end
  raise ArgumentError, "Invalid arguments when calling batch(#{sqlStatements})"
end

- (self) batch_callable_with_params(sqlStatement = nil, inArgs = nil, outArgs = nil) { ... }

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.

Parameters:

  • sqlStatement (String) (defaults to: nil)
    sql statement
  • inArgs (Array<Array<String,Object>>) (defaults to: nil)
    the callable statement input arguments
  • outArgs (Array<Array<String,Object>>) (defaults to: nil)
    the callable statement output arguments

Yields:

  • the result handler

Returns:

  • (self)

Raises:

  • (ArgumentError)


278
279
280
281
282
283
284
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql/sql_connection.rb', line 278

def batch_callable_with_params(sqlStatement=nil,inArgs=nil,outArgs=nil)
  if sqlStatement.class == String && inArgs.class == Array && outArgs.class == Array && 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(sqlStatement,inArgs.map { |element| ::Vertx::Util::Utils.to_json_array(element) },outArgs.map { |element| ::Vertx::Util::Utils.to_json_array(element) },(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result.to_a.map { |elt| elt } : nil) }))
    return self
  end
  raise ArgumentError, "Invalid arguments when calling batch_callable_with_params(#{sqlStatement},#{inArgs},#{outArgs})"
end

- (self) batch_with_params(sqlStatement = nil, args = nil) { ... }

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.

Parameters:

  • sqlStatement (String) (defaults to: nil)
    sql statement
  • args (Array<Array<String,Object>>) (defaults to: nil)
    the prepared statement arguments

Yields:

  • the result handler

Returns:

  • (self)

Raises:

  • (ArgumentError)


263
264
265
266
267
268
269
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql/sql_connection.rb', line 263

def batch_with_params(sqlStatement=nil,args=nil)
  if sqlStatement.class == String && args.class == Array && block_given?
    @j_del.java_method(:batchWithParams, [Java::java.lang.String.java_class,Java::JavaUtil::List.java_class,Java::IoVertxCore::Handler.java_class]).call(sqlStatement,args.map { |element| ::Vertx::Util::Utils.to_json_array(element) },(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result.to_a.map { |elt| elt } : nil) }))
    return self
  end
  raise ArgumentError, "Invalid arguments when calling batch_with_params(#{sqlStatement},#{args})"
end

- (self) call(sql = nil) { ... }

Calls the given SQL PROCEDURE which returns the result from the procedure.

Parameters:

  • sql (String) (defaults to: nil)
    the SQL to execute. For example {call getEmpName}.

Yields:

  • the handler which is called once the operation completes. It will return a ResultSet.

Returns:

  • (self)

Raises:

  • (ArgumentError)


175
176
177
178
179
180
181
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql/sql_connection.rb', line 175

def call(sql=nil)
  if sql.class == String && block_given?
    @j_del.java_method(:call, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(sql,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result != nil ? JSON.parse(ar.result.toJson.encode) : nil : nil) }))
    return self
  end
  raise ArgumentError, "Invalid arguments when calling call(#{sql})"
end

- (self) call_with_params(sql = nil, params = nil, outputs = nil) { ... }

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"]

Parameters:

  • sql (String) (defaults to: nil)
    the SQL to execute. For example {call getEmpName (?, ?)}.
  • params (Array<String,Object>) (defaults to: nil)
    these are the parameters to fill the statement.
  • outputs (Array<String,Object>) (defaults to: nil)
    these are the outputs to fill the statement.

Yields:

  • the handler which is called once the operation completes. It will return a ResultSet.

Returns:

  • (self)

Raises:

  • (ArgumentError)


196
197
198
199
200
201
202
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql/sql_connection.rb', line 196

def call_with_params(sql=nil,params=nil,outputs=nil)
  if sql.class == String && params.class == Array && outputs.class == Array && 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(sql,::Vertx::Util::Utils.to_json_array(params),::Vertx::Util::Utils.to_json_array(outputs),(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result != nil ? JSON.parse(ar.result.toJson.encode) : nil : nil) }))
    return self
  end
  raise ArgumentError, "Invalid arguments when calling call_with_params(#{sql},#{params},#{outputs})"
end

- (void) close { ... }

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.

Yields:

  • the handler called when this operation completes.

Raises:

  • (ArgumentError)


206
207
208
209
210
211
212
213
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql/sql_connection.rb', line 206

def close
  if !block_given?
    return @j_del.java_method(:close, []).call()
  elsif block_given?
    return @j_del.java_method(:close, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |ar| yield(ar.failed ? ar.cause : nil) }))
  end
  raise ArgumentError, "Invalid arguments when calling close()"
end

- (self) commit { ... }

Commits all changes made since the previous commit/rollback.

Yields:

  • the handler called when this operation completes.

Returns:

  • (self)

Raises:

  • (ArgumentError)


217
218
219
220
221
222
223
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql/sql_connection.rb', line 217

def commit
  if block_given?
    @j_del.java_method(:commit, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |ar| yield(ar.failed ? ar.cause : nil) }))
    return self
  end
  raise ArgumentError, "Invalid arguments when calling commit()"
end

- (self) execute(sql = nil) { ... }

Executes the given SQL statement

Parameters:

  • sql (String) (defaults to: nil)
    the SQL to execute. For example CREATE TABLE IF EXISTS table ...

Yields:

  • the handler which is called once this operation completes.

Returns:

  • (self)

Raises:

  • (ArgumentError)


93
94
95
96
97
98
99
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql/sql_connection.rb', line 93

def execute(sql=nil)
  if sql.class == String && block_given?
    @j_del.java_method(:execute, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(sql,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil) }))
    return self
  end
  raise ArgumentError, "Invalid arguments when calling execute(#{sql})"
end

- (self) get_transaction_isolation { ... }

Attempts to return the transaction isolation level for this Connection object to the one given.

Yields:

  • the handler called when this operation completes.

Returns:

  • (self)

Raises:

  • (ArgumentError)


301
302
303
304
305
306
307
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql/sql_connection.rb', line 301

def get_transaction_isolation
  if block_given?
    @j_del.java_method(:getTransactionIsolation, [Java::IoVertxCore::Handler.java_class]).call(nil)
    return self
  end
  raise ArgumentError, "Invalid arguments when calling get_transaction_isolation()"
end

- (self) query(sql = nil) { ... }

Executes the given SQL SELECT statement which returns the results of the query.

Parameters:

  • sql (String) (defaults to: nil)
    the SQL to execute. For example SELECT * FROM table ....

Yields:

  • the handler which is called once the operation completes. It will return a ResultSet.

Returns:

  • (self)

Raises:

  • (ArgumentError)


104
105
106
107
108
109
110
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql/sql_connection.rb', line 104

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 ? ar.result != nil ? JSON.parse(ar.result.toJson.encode) : nil : nil) }))
    return self
  end
  raise ArgumentError, "Invalid arguments when calling query(#{sql})"
end

- (self) query_single(sql = nil) { ... }

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.

Parameters:

  • sql (String) (defaults to: nil)
    the statement to execute

Yields:

  • the result handler

Returns:

  • (self)

Raises:

  • (ArgumentError)


41
42
43
44
45
46
47
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql/sql_connection.rb', line 41

def query_single(sql=nil)
  if sql.class == String && block_given?
    @j_del.java_method(:querySingle, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(sql,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result != nil ? JSON.parse(ar.result.encode) : nil : nil) }))
    return self
  end
  raise ArgumentError, "Invalid arguments when calling query_single(#{sql})"
end

- (self) query_single_with_params(sql = nil, arguments = nil) { ... }

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.

Parameters:

  • sql (String) (defaults to: nil)
    the statement to execute
  • arguments (Array<String,Object>) (defaults to: nil)
    the arguments

Yields:

  • the result handler

Returns:

  • (self)

Raises:

  • (ArgumentError)


55
56
57
58
59
60
61
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql/sql_connection.rb', line 55

def query_single_with_params(sql=nil,arguments=nil)
  if sql.class == String && arguments.class == Array && block_given?
    @j_del.java_method(:querySingleWithParams, [Java::java.lang.String.java_class,Java::IoVertxCoreJson::JsonArray.java_class,Java::IoVertxCore::Handler.java_class]).call(sql,::Vertx::Util::Utils.to_json_array(arguments),(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result != nil ? JSON.parse(ar.result.encode) : nil : nil) }))
    return self
  end
  raise ArgumentError, "Invalid arguments when calling query_single_with_params(#{sql},#{arguments})"
end

- (self) query_stream(sql = nil) { ... }

Executes the given SQL SELECT statement which returns the results of the query as a read stream.

Parameters:

  • sql (String) (defaults to: nil)
    the SQL to execute. For example SELECT * FROM table ....

Yields:

  • the handler which is called once the operation completes. It will return a SQLRowStream.

Returns:

  • (self)

Raises:

  • (ArgumentError)


115
116
117
118
119
120
121
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql/sql_connection.rb', line 115

def query_stream(sql=nil)
  if sql.class == String && block_given?
    @j_del.java_method(:queryStream, [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,::VertxSql::SQLRowStream) : nil) }))
    return self
  end
  raise ArgumentError, "Invalid arguments when calling query_stream(#{sql})"
end

- (self) query_stream_with_params(sql = nil, params = nil) { ... }

Executes the given SQL SELECT statement which returns the results of the query as a read stream.

Parameters:

  • sql (String) (defaults to: nil)
    the SQL to execute. For example SELECT * FROM table ....
  • params (Array<String,Object>) (defaults to: nil)
    these are the parameters to fill the statement.

Yields:

  • the handler which is called once the operation completes. It will return a SQLRowStream.

Returns:

  • (self)

Raises:

  • (ArgumentError)


139
140
141
142
143
144
145
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql/sql_connection.rb', line 139

def query_stream_with_params(sql=nil,params=nil)
  if sql.class == String && params.class == Array && block_given?
    @j_del.java_method(:queryStreamWithParams, [Java::java.lang.String.java_class,Java::IoVertxCoreJson::JsonArray.java_class,Java::IoVertxCore::Handler.java_class]).call(sql,::Vertx::Util::Utils.to_json_array(params),(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxSql::SQLRowStream) : nil) }))
    return self
  end
  raise ArgumentError, "Invalid arguments when calling query_stream_with_params(#{sql},#{params})"
end

- (self) query_with_params(sql = nil, params = nil) { ... }

Executes the given SQL SELECT prepared statement which returns the results of the query.

Parameters:

  • sql (String) (defaults to: nil)
    the SQL to execute. For example SELECT * FROM table ....
  • params (Array<String,Object>) (defaults to: nil)
    these are the parameters to fill the statement.

Yields:

  • the handler which is called once the operation completes. It will return a ResultSet.

Returns:

  • (self)

Raises:

  • (ArgumentError)


127
128
129
130
131
132
133
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql/sql_connection.rb', line 127

def query_with_params(sql=nil,params=nil)
  if sql.class == String && params.class == Array && block_given?
    @j_del.java_method(:queryWithParams, [Java::java.lang.String.java_class,Java::IoVertxCoreJson::JsonArray.java_class,Java::IoVertxCore::Handler.java_class]).call(sql,::Vertx::Util::Utils.to_json_array(params),(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result != nil ? JSON.parse(ar.result.toJson.encode) : nil : nil) }))
    return self
  end
  raise ArgumentError, "Invalid arguments when calling query_with_params(#{sql},#{params})"
end

- (self) rollback { ... }

Rolls back all changes made since the previous commit/rollback.

Yields:

  • the handler called when this operation completes.

Returns:

  • (self)

Raises:

  • (ArgumentError)


227
228
229
230
231
232
233
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql/sql_connection.rb', line 227

def rollback
  if block_given?
    @j_del.java_method(:rollback, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |ar| yield(ar.failed ? ar.cause : nil) }))
    return self
  end
  raise ArgumentError, "Invalid arguments when calling rollback()"
end

- (self) set_auto_commit(autoCommit = nil) { ... }

Sets the auto commit flag for this connection. True by default.

Parameters:

  • autoCommit (true, false) (defaults to: nil)
    the autoCommit flag, true by default.

Yields:

  • the handler which is called once this operation completes.

Returns:

  • (self)

Raises:

  • (ArgumentError)


82
83
84
85
86
87
88
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql/sql_connection.rb', line 82

def set_auto_commit(autoCommit=nil)
  if (autoCommit.class == TrueClass || autoCommit.class == FalseClass) && block_given?
    @j_del.java_method(:setAutoCommit, [Java::boolean.java_class,Java::IoVertxCore::Handler.java_class]).call(autoCommit,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil) }))
    return self
  end
  raise ArgumentError, "Invalid arguments when calling set_auto_commit(#{autoCommit})"
end

- (self) set_options(options = nil)

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.

Parameters:

  • options (Hash) (defaults to: nil)
    the options to modify the unwrapped connection.

Returns:

  • (self)

Raises:

  • (ArgumentError)


71
72
73
74
75
76
77
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql/sql_connection.rb', line 71

def set_options(options=nil)
  if options.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(options)))
    return self
  end
  raise ArgumentError, "Invalid arguments when calling set_options(#{options})"
end

- (self) set_query_timeout(timeoutInSeconds = nil)

Sets a connection wide query timeout. It can be over written at any time and becomes active on the next query call.

Parameters:

  • timeoutInSeconds (Fixnum) (defaults to: nil)
    the max amount of seconds the query can take to execute.

Returns:

  • (self)

Raises:

  • (ArgumentError)


239
240
241
242
243
244
245
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql/sql_connection.rb', line 239

def set_query_timeout(timeoutInSeconds=nil)
  if timeoutInSeconds.class == Fixnum && !block_given?
    @j_del.java_method(:setQueryTimeout, [Java::int.java_class]).call(timeoutInSeconds)
    return self
  end
  raise ArgumentError, "Invalid arguments when calling set_query_timeout(#{timeoutInSeconds})"
end

- (self) set_transaction_isolation(isolation = nil) { ... }

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.

Parameters:

  • isolation (:READ_UNCOMMITTED, :READ_COMMITTED, :REPEATABLE_READ, :SERIALIZABLE, :NONE) (defaults to: nil)
    the level of isolation

Yields:

  • the handler called when this operation completes.

Returns:

  • (self)

Raises:

  • (ArgumentError)


291
292
293
294
295
296
297
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql/sql_connection.rb', line 291

def set_transaction_isolation(isolation=nil)
  if isolation.class == Symbol && block_given?
    @j_del.java_method(:setTransactionIsolation, [Java::IoVertxExtSql::TransactionIsolation.java_class,Java::IoVertxCore::Handler.java_class]).call(Java::IoVertxExtSql::TransactionIsolation.valueOf(isolation.to_s),(Proc.new { |ar| yield(ar.failed ? ar.cause : nil) }))
    return self
  end
  raise ArgumentError, "Invalid arguments when calling set_transaction_isolation(#{isolation})"
end

- (self) update(sql = nil) { ... }

Executes the given SQL statement which may be an INSERT, UPDATE, or DELETE statement.

Parameters:

  • sql (String) (defaults to: nil)
    the SQL to execute. For example INSERT INTO table ...

Yields:

  • the handler which is called once the operation completes.

Returns:

  • (self)

Raises:

  • (ArgumentError)


151
152
153
154
155
156
157
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql/sql_connection.rb', line 151

def update(sql=nil)
  if sql.class == String && block_given?
    @j_del.java_method(:update, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(sql,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result != nil ? JSON.parse(ar.result.toJson.encode) : nil : nil) }))
    return self
  end
  raise ArgumentError, "Invalid arguments when calling update(#{sql})"
end

- (self) update_with_params(sql = nil, params = nil) { ... }

Executes the given prepared statement which may be an INSERT, UPDATE, or DELETE statement with the given parameters

Parameters:

  • sql (String) (defaults to: nil)
    the SQL to execute. For example INSERT INTO table ...
  • params (Array<String,Object>) (defaults to: nil)
    these are the parameters to fill the statement.

Yields:

  • the handler which is called once the operation completes.

Returns:

  • (self)

Raises:

  • (ArgumentError)


164
165
166
167
168
169
170
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql/sql_connection.rb', line 164

def update_with_params(sql=nil,params=nil)
  if sql.class == String && params.class == Array && block_given?
    @j_del.java_method(:updateWithParams, [Java::java.lang.String.java_class,Java::IoVertxCoreJson::JsonArray.java_class,Java::IoVertxCore::Handler.java_class]).call(sql,::Vertx::Util::Utils.to_json_array(params),(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result != nil ? JSON.parse(ar.result.toJson.encode) : nil : nil) }))
    return self
  end
  raise ArgumentError, "Invalid arguments when calling update_with_params(#{sql},#{params})"
end