Class List Method List File List

# Class: VertxMysqlPostgresql::AsyncSQLClient

Inherits:
  Object
  - Object
  - VertxMysqlPostgresql::AsyncSQLClient
  show all
Defined in:
  /Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-mysql-postgresql/async_sql_client.rb

## Overview

Represents an asynchronous SQL client

## Direct Known Subclasses

MySQLClient, PostgreSQLClient

## 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)

- - (void) close { ... }
  Close the client and release all resources.
- - (void) get_connection { ... }
  Returns a connection that can be used to perform SQL operations on.

## Class Method Details

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

Returns:

- (`Boolean`)

    18
    19
    20
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-mysql-postgresql/async_sql_client.rb', line 18

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

### + (`Object`) j_api_type

    27
    28
    29
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-mysql-postgresql/async_sql_client.rb', line 27

    def self.j_api_type
      @@j_api_type
    end

### + (`Object`) j_class

    30
    31
    32
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-mysql-postgresql/async_sql_client.rb', line 30

    def self.j_class
      Java::IoVertxExtAsyncsql::AsyncSQLClient.java_class
    end

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

    24
    25
    26
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-mysql-postgresql/async_sql_client.rb', line 24

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

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

    21
    22
    23
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-mysql-postgresql/async_sql_client.rb', line 21

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

## Instance Method Details

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

This method returns an undefined value.

Close the client and release all resources. Call the handler when close is complete.

Yields:

- handler that will be called when close is complete

Raises:

- (`ArgumentError`)

    37
    38
    39
    40
    41
    42
    43
    44
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-mysql-postgresql/async_sql_client.rb', line 37

    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

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

This method returns an undefined value.

Returns a connection that can be used to perform SQL operations on. It's important to remember to close the connection when you are done, so it is returned to the pool.

Yields:

- the handler which is called when the `JdbcConnection` object is ready for use.

Raises:

- (`ArgumentError`)

    49
    50
    51
    52
    53
    54
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-mysql-postgresql/async_sql_client.rb', line 49

    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,::VertxSql::SQLConnection) : nil) }))
      end
      raise ArgumentError, "Invalid arguments when calling get_connection()"
    end