Class: VertxSqlClient::PreparedQuery

Inherits:
Query
  • Object
show all
Defined in:
/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql-client/prepared_query.rb

Overview

A query for a prepared statement allowing parameterized execution of the query, this query will use a prepared statement.

Instance Method Summary (collapse)

Instance Method Details

- (void) execute(tuple = nil) { ... }

This method returns an undefined value.

Execute the query.

Parameters:

Yields:

  • the handler receiving the response

Raises:

  • (ArgumentError)


27
28
29
30
31
32
33
34
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql-client/prepared_query.rb', line 27

def execute(tuple=nil)
  if block_given? && tuple == nil
    return @j_del.java_method(:execute, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? @j_arg_T.wrap(ar.result) : nil) }))
  elsif tuple.class.method_defined?(:j_del) && block_given?
    return @j_del.java_method(:execute, [Java::IoVertxSqlclient::Tuple.java_class,Java::IoVertxCore::Handler.java_class]).call(tuple.j_del,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? @j_arg_T.wrap(ar.result) : nil) }))
  end
  raise ArgumentError, "Invalid arguments when calling execute(#{tuple})"
end

- (void) execute_batch(batch = nil) { ... }

This method returns an undefined value.

Execute the query with a batch of tuples.

Parameters:

Yields:

  • the handler receiving the response

Raises:

  • (ArgumentError)


39
40
41
42
43
44
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql-client/prepared_query.rb', line 39

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

- (::VertxSqlClient::PreparedQuery) mapping(mapper = nil) { ... }

Use the specified mapper for mapping Row to .

Yields:

Returns:

Raises:

  • (ArgumentError)


48
49
50
51
52
53
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql-client/prepared_query.rb', line 48

def mapping(mapper=nil)
  if block_given? && mapper == nil
    return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:mapping, [Java::JavaUtilFunction::Function.java_class]).call((Proc.new { |event| ::Vertx::Util::Utils.to_object(yield(::Vertx::Util::Utils.safe_create(event,::VertxSqlClient::Row))) })),::VertxSqlClient::PreparedQuery,::VertxSqlClient::RowSet.j_api_type)
  end
  raise ArgumentError, "Invalid arguments when calling mapping(#{mapper})"
end