Class: VertxDb2Client::DB2Connection

Inherits:
VertxSqlClient::SqlConnection show all
Defined in:
/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-db2-client/db2_connection.rb

Overview

A connection to DB2 server.

Constant Summary

@@j_api_type =
Object.new

Class Method Summary (collapse)

Instance Method Summary (collapse)

Class Method Details

+ (Boolean) accept?(obj)

Returns:

  • (Boolean)


27
28
29
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-db2-client/db2_connection.rb', line 27

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

+ (void) connect(vertx, connectOptions, handler) { ... } + (void) connect(vertx, connectionUri, handler) { ... }

This method returns an undefined value.

Like #connect with options build from connectionUri.

Overloads:

  • + (void) connect(vertx, connectOptions, handler) { ... }

    Parameters:

    • vertx (::Vertx::Vertx)
      the vertx instance
    • connectOptions (Hash)
      the options for the connection

    Yields:

    • the handler called with the connection or the failure
  • + (void) connect(vertx, connectionUri, handler) { ... }

    Parameters:

    Yields:

Raises:

  • (ArgumentError)


105
106
107
108
109
110
111
112
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-db2-client/db2_connection.rb', line 105

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::IoVertxDb2client::DB2Connection.java_method(:connect, [Java::IoVertxCore::Vertx.java_class,Java::IoVertxDb2client::DB2ConnectOptions.java_class,Java::IoVertxCore::Handler.java_class]).call(param_1.j_del,Java::IoVertxDb2client::DB2ConnectOptions.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,::VertxDb2Client::DB2Connection) : nil) }))
  elsif param_1.class.method_defined?(:j_del) && param_2.class == String && block_given?
    return Java::IoVertxDb2client::DB2Connection.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,::VertxDb2Client::DB2Connection) : nil) }))
  end
  raise ArgumentError, "Invalid arguments when calling connect(#{param_1},#{param_2})"
end

+ (Object) j_api_type



36
37
38
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-db2-client/db2_connection.rb', line 36

def self.j_api_type
  @@j_api_type
end

+ (Object) j_class



39
40
41
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-db2-client/db2_connection.rb', line 39

def self.j_class
  Java::IoVertxDb2client::DB2Connection.java_class
end

+ (Object) unwrap(obj)



33
34
35
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-db2-client/db2_connection.rb', line 33

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

+ (Object) wrap(obj)



30
31
32
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-db2-client/db2_connection.rb', line 30

def @@j_api_type.wrap(obj)
  DB2Connection.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.

Returns:

Raises:

  • (ArgumentError)


66
67
68
69
70
71
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-db2-client/db2_connection.rb', line 66

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.

Raises:

  • (ArgumentError)


81
82
83
84
85
86
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-db2-client/db2_connection.rb', line 81

def close
  if !block_given?
    return @j_del.java_method(:close, []).call()
  end
  raise ArgumentError, "Invalid arguments when calling close()"
end

- (self) close_handler { ... }

Yields:

Returns:

  • (self)

Raises:

  • (ArgumentError)


134
135
136
137
138
139
140
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-db2-client/db2_connection.rb', line 134

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

- (::VertxSqlClient::DatabaseMetadata) database_metadata

Returns The static metadata about the backend database server for this connection

Returns:

Raises:

  • (ArgumentError)


88
89
90
91
92
93
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-db2-client/db2_connection.rb', line 88

def 
  if !block_given?
    return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:databaseMetadata, []).call(),::VertxSqlClient::DatabaseMetadata)
  end
  raise ArgumentError, "Invalid arguments when calling database_metadata()"
end

- (self) debug { ... }

Send a DEBUG command to dump debug information to the server's stdout.

Yields:

  • the handler notified with the execution result

Returns:

  • (self)

Raises:

  • (ArgumentError)


154
155
156
157
158
159
160
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-db2-client/db2_connection.rb', line 154

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 { ... }

Yields:

Returns:

  • (self)

Raises:

  • (ArgumentError)


125
126
127
128
129
130
131
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-db2-client/db2_connection.rb', line 125

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) ping { ... }

Send a PING command to check if the server is alive.

Yields:

  • the handler notified when the server responses to client

Returns:

  • (self)

Raises:

  • (ArgumentError)


144
145
146
147
148
149
150
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-db2-client/db2_connection.rb', line 144

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) { ... }

Parameters:

  • sql (String) (defaults to: nil)

Yields:

Returns:

  • (self)

Raises:

  • (ArgumentError)


116
117
118
119
120
121
122
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-db2-client/db2_connection.rb', line 116

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

- (::VertxSqlClient::PreparedQuery) prepared_query(sql = nil)

Create a prepared query, one of the or methods must be called to execute the query.

Parameters:

  • sql (String) (defaults to: nil)

Returns:

Raises:

  • (ArgumentError)


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

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

- (::VertxSqlClient::Query) query(sql = nil)

Create a query, the method must be called to execute the query.

Parameters:

  • sql (String) (defaults to: nil)

Returns:

Raises:

  • (ArgumentError)


45
46
47
48
49
50
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-db2-client/db2_connection.rb', line 45

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

Returns:

  • (true, false)
    whether the connection uses SSL

Raises:

  • (ArgumentError)


73
74
75
76
77
78
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-db2-client/db2_connection.rb', line 73

def ssl?
  if !block_given?
    return @j_del.java_method(:isSSL, []).call()
  end
  raise ArgumentError, "Invalid arguments when calling ssl?()"
end