Class List Method List File List

# Class: VertxMysqlPostgresql::PostgreSQLClient

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

## Overview

Represents an PostgreSQL client

## Constant Summary

@@j_api_type =

      Object.new

## Class Method Summary (collapse)

- + (Boolean) accept?(obj)
- + (::VertxMysqlPostgresql::AsyncSQLClient) create_non_shared(vertx = nil, config = nil)
  Create a PostgreSQL client which maintains its own pool.
- + (::VertxMysqlPostgresql::AsyncSQLClient) create_shared(vertx = nil, config = nil, poolName = nil)
  Create a PostgreSQL client which shares its pool with any other MySQL clients created with the same pool name.
- + (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`)

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

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

### + (`::VertxMysqlPostgresql::AsyncSQLClient`) create_non_shared(vertx = nil, config = nil)

Create a PostgreSQL client which maintains its own pool.

Parameters:

- vertx (`::Vertx::Vertx`) (defaults to: `nil`) —
  the Vert.x instance
- config (`Hash{String => Object}`) (defaults to: `nil`) —
  the configuration

Returns:

- (`::VertxMysqlPostgresql::AsyncSQLClient`) —
  the client

Raises:

- (`ArgumentError`)

    62
    63
    64
    65
    66
    67
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-mysql-postgresql/postgre_sql_client.rb', line 62

    def self.create_non_shared(vertx=nil,config=nil)
      if vertx.class.method_defined?(:j_del) && config.class == Hash && !block_given?
        return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtAsyncsql::PostgreSQLClient.java_method(:createNonShared, [Java::IoVertxCore::Vertx.java_class,Java::IoVertxCoreJson::JsonObject.java_class]).call(vertx.j_del,::Vertx::Util::Utils.to_json_object(config)),::VertxMysqlPostgresql::AsyncSQLClient)
      end
      raise ArgumentError, "Invalid arguments when calling create_non_shared(#{vertx},#{config})"
    end

### + (`::VertxMysqlPostgresql::AsyncSQLClient`) create_shared(vertx = nil, config = nil, poolName = nil)

Create a PostgreSQL client which shares its pool with any other MySQL clients created with the same pool name.

Parameters:

- vertx (`::Vertx::Vertx`) (defaults to: `nil`) —
  the Vert.x instance
- config (`Hash{String => Object}`) (defaults to: `nil`) —
  the configuration
- poolName (`String`) (defaults to: `nil`) —
  the pool name

Returns:

- (`::VertxMysqlPostgresql::AsyncSQLClient`) —
  the client

Raises:

- (`ArgumentError`)

    73
    74
    75
    76
    77
    78
    79
    80
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-mysql-postgresql/postgre_sql_client.rb', line 73

    def self.create_shared(vertx=nil,config=nil,poolName=nil)
      if vertx.class.method_defined?(:j_del) && config.class == Hash && !block_given? && poolName == nil
        return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtAsyncsql::PostgreSQLClient.java_method(:createShared, [Java::IoVertxCore::Vertx.java_class,Java::IoVertxCoreJson::JsonObject.java_class]).call(vertx.j_del,::Vertx::Util::Utils.to_json_object(config)),::VertxMysqlPostgresql::AsyncSQLClient)
      elsif vertx.class.method_defined?(:j_del) && config.class == Hash && poolName.class == String && !block_given?
        return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtAsyncsql::PostgreSQLClient.java_method(:createShared, [Java::IoVertxCore::Vertx.java_class,Java::IoVertxCoreJson::JsonObject.java_class,Java::java.lang.String.java_class]).call(vertx.j_del,::Vertx::Util::Utils.to_json_object(config),poolName),::VertxMysqlPostgresql::AsyncSQLClient)
      end
      raise ArgumentError, "Invalid arguments when calling create_shared(#{vertx},#{config},#{poolName})"
    end

### + (`Object`) j_api_type

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

    def self.j_api_type
      @@j_api_type
    end

### + (`Object`) j_class

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

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

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

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

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

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

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

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

    40
    41
    42
    43
    44
    45
    46
    47
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-mysql-postgresql/postgre_sql_client.rb', line 40

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

    52
    53
    54
    55
    56
    57
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-mysql-postgresql/postgre_sql_client.rb', line 52

    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