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

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

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

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

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

    33
    34
    35
    36
    37
    38
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-mysql-postgresql/async_sql_client.rb', line 33

    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