Class List Method List File List

# Class: VertxDb2Client::DB2Pool

Inherits:
  VertxSqlClient::Pool
  - Object
  - VertxSqlClient::SqlClient
  - VertxSqlClient::Pool
  - VertxDb2Client::DB2Pool
  show all
Defined in:
  /Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-db2-client/db2_pool.rb

## Overview

A pool of DB2 connections.

## Constant Summary

@@j_api_type =

      Object.new

## Class Method Summary (collapse)

- + (Boolean) accept?(obj)
- + (Object) j_api_type
- + (Object) j_class
- + (::VertxDb2Client::DB2Pool) pool(param_1 = nil, param_2 = nil, param_3 = nil)
  Like #pool with a specific instance.
- + (Object) unwrap(obj)
- + (Object) wrap(obj)

## Instance Method Summary (collapse)

- - (void) begin { ... }
  Borrow a connection from the pool and begin a transaction, the underlying connection will be returned to the pool when the transaction ends.
- - (void) close
  Close the pool and release the associated resources.
- - (void) get_connection { ... }
  Get a connection from the pool.
- - (::VertxSqlClient::PreparedQuery) prepared_query(sql = nil)
  A connection is borrowed from the connection pool when the query is executed and then immediately returned to the pool after it completes.
- - (::VertxSqlClient::Query) query(sql = nil)
  A connection is borrowed from the connection pool when the query is executed and then immediately returned to the pool after it completes.

## Class Method Details

### + (`Boolean`) accept?(obj)

Returns:

- (`Boolean`)

    24
    25
    26
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-db2-client/db2_pool.rb', line 24

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

### + (`Object`) j_api_type

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

    def self.j_api_type
      @@j_api_type
    end

### + (`Object`) j_class

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

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

### + (`::VertxDb2Client::DB2Pool`) pool(connectionUri) + (`::VertxDb2Client::DB2Pool`) pool(connectionUri, poolOptions) + (`::VertxDb2Client::DB2Pool`) pool(vertx, connectionUri) + (`::VertxDb2Client::DB2Pool`) pool(connectOptions, poolOptions) + (`::VertxDb2Client::DB2Pool`) pool(vertx, connectionUri, poolOptions) + (`::VertxDb2Client::DB2Pool`) pool(vertx, connectOptions, poolOptions)

Like #pool with a specific instance.

Overloads:

- + (`::VertxDb2Client::DB2Pool`) pool(connectionUri)

  Parameters:

  - connectionUri (`String`)
- + (`::VertxDb2Client::DB2Pool`) pool(connectionUri, poolOptions)

  Parameters:

  - connectionUri (`String`)
  - poolOptions (`Hash`)
- + (`::VertxDb2Client::DB2Pool`) pool(vertx, connectionUri)

  Parameters:

  - vertx (`::Vertx::Vertx`)
  - connectionUri (`String`)
- + (`::VertxDb2Client::DB2Pool`) pool(connectOptions, poolOptions)

  Parameters:

  - connectOptions (`Hash`) —
    the options for the connection
  - poolOptions (`Hash`) —
    the options for creating the pool
- + (`::VertxDb2Client::DB2Pool`) pool(vertx, connectionUri, poolOptions)

  Parameters:

  - vertx (`::Vertx::Vertx`)
  - connectionUri (`String`)
  - poolOptions (`Hash`)
- + (`::VertxDb2Client::DB2Pool`) pool(vertx, connectOptions, poolOptions)

  Parameters:

  - vertx (`::Vertx::Vertx`)
  - connectOptions (`Hash`)
  - poolOptions (`Hash`)

Returns:

- (`::VertxDb2Client::DB2Pool`)

Raises:

- (`ArgumentError`)

    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-db2-client/db2_pool.rb', line 112

    def self.pool(param_1=nil,param_2=nil,param_3=nil)
      if param_1.class == String && !block_given? && param_2 == nil && param_3 == nil
        return ::Vertx::Util::Utils.safe_create(Java::IoVertxDb2client::DB2Pool.java_method(:pool, [Java::java.lang.String.java_class]).call(param_1),::VertxDb2Client::DB2Pool)
      elsif param_1.class == String && param_2.class == Hash && !block_given? && param_3 == nil
        return ::Vertx::Util::Utils.safe_create(Java::IoVertxDb2client::DB2Pool.java_method(:pool, [Java::java.lang.String.java_class,Java::IoVertxSqlclient::PoolOptions.java_class]).call(param_1,Java::IoVertxSqlclient::PoolOptions.new(::Vertx::Util::Utils.to_json_object(param_2))),::VertxDb2Client::DB2Pool)
      elsif param_1.class.method_defined?(:j_del) && param_2.class == String && !block_given? && param_3 == nil
        return ::Vertx::Util::Utils.safe_create(Java::IoVertxDb2client::DB2Pool.java_method(:pool, [Java::IoVertxCore::Vertx.java_class,Java::java.lang.String.java_class]).call(param_1.j_del,param_2),::VertxDb2Client::DB2Pool)
      elsif param_1.class == Hash && param_2.class == Hash && !block_given? && param_3 == nil
        return ::Vertx::Util::Utils.safe_create(Java::IoVertxDb2client::DB2Pool.java_method(:pool, [Java::IoVertxDb2client::DB2ConnectOptions.java_class,Java::IoVertxSqlclient::PoolOptions.java_class]).call(Java::IoVertxDb2client::DB2ConnectOptions.new(::Vertx::Util::Utils.to_json_object(param_1)),Java::IoVertxSqlclient::PoolOptions.new(::Vertx::Util::Utils.to_json_object(param_2))),::VertxDb2Client::DB2Pool)
      elsif param_1.class.method_defined?(:j_del) && param_2.class == String && param_3.class == Hash && !block_given?
        return ::Vertx::Util::Utils.safe_create(Java::IoVertxDb2client::DB2Pool.java_method(:pool, [Java::IoVertxCore::Vertx.java_class,Java::java.lang.String.java_class,Java::IoVertxSqlclient::PoolOptions.java_class]).call(param_1.j_del,param_2,Java::IoVertxSqlclient::PoolOptions.new(::Vertx::Util::Utils.to_json_object(param_3))),::VertxDb2Client::DB2Pool)
      elsif param_1.class.method_defined?(:j_del) && param_2.class == Hash && param_3.class == Hash && !block_given?
        return ::Vertx::Util::Utils.safe_create(Java::IoVertxDb2client::DB2Pool.java_method(:pool, [Java::IoVertxCore::Vertx.java_class,Java::IoVertxDb2client::DB2ConnectOptions.java_class,Java::IoVertxSqlclient::PoolOptions.java_class]).call(param_1.j_del,Java::IoVertxDb2client::DB2ConnectOptions.new(::Vertx::Util::Utils.to_json_object(param_2)),Java::IoVertxSqlclient::PoolOptions.new(::Vertx::Util::Utils.to_json_object(param_3))),::VertxDb2Client::DB2Pool)
      end
      raise ArgumentError, "Invalid arguments when calling pool(#{param_1},#{param_2},#{param_3})"
    end

### + (`Object`) unwrap(obj)

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

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

### + (`Object`) wrap(obj)

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

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

## Instance Method Details

### - (`void`) begin { ... }

This method returns an undefined value.

Borrow a connection from the pool and begin a transaction, the underlying connection will be returned to the pool when the transaction ends.

Yields:

Raises:

- (`ArgumentError`)

    76
    77
    78
    79
    80
    81
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-db2-client/db2_pool.rb', line 76

    def begin
      if block_given?
        return @j_del.java_method(:begin, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxSqlClient::Transaction) : nil) }))
      end
      raise ArgumentError, "Invalid arguments when calling begin()"
    end

### - (`void`) close

This method returns an undefined value.

Close the pool and release the associated resources.

Raises:

- (`ArgumentError`)

    84
    85
    86
    87
    88
    89
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-db2-client/db2_pool.rb', line 84

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

### - (`void`) get_connection { ... }

This method returns an undefined value.

Get a connection from the pool.

Yields:

- the handler that will get the connection result

Raises:

- (`ArgumentError`)

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

    def get_connection
      if block_given?
        return @j_del.java_method(:getConnection, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxSqlClient::SqlConnection) : nil) }))
      end
      raise ArgumentError, "Invalid arguments when calling get_connection()"
    end

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

A connection is borrowed from the connection pool when the query is executed and then immediately returned to the pool after it completes.

Parameters:

- sql (`String`) (defaults to: `nil`)

Returns:

- (`::VertxSqlClient::PreparedQuery`)

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_pool.rb', line 66

    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)

A connection is borrowed from the connection pool when the query is executed and then immediately returned to the pool after it completes.

Parameters:

- sql (`String`) (defaults to: `nil`)

Returns:

- (`::VertxSqlClient::Query`)

Raises:

- (`ArgumentError`)

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

    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