Class List Method List File List

# Class: VertxMysqlPostgresql::PostgreSQLClient

Inherits:
  AsyncSQLClient
  - Object
  - VertxSql::SQLClient
  - 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 { ... }
- - (self) get_connection { ... }
- - (self) query(sql = nil) { ... }
- - (self) query_single(sql = nil) { ... }
- - (self) query_single_with_params(sql = nil, arguments = nil) { ... }
- - (self) query_with_params(sql = nil, arguments = nil) { ... }
- - (self) update(sql = nil) { ... }
- - (self) update_with_params(sql = nil, params = nil) { ... }

## Class Method Details

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

Returns:

- (`Boolean`)

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

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

    124
    125
    126
    127
    128
    129
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-mysql-postgresql/postgre_sql_client.rb', line 124

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

    135
    136
    137
    138
    139
    140
    141
    142
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-mysql-postgresql/postgre_sql_client.rb', line 135

    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

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

    def self.j_api_type
      @@j_api_type
    end

### + (`Object`) j_class

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

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

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

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

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

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

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

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

## Instance Method Details

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

This method returns an undefined value.

Yields:

Raises:

- (`ArgumentError`)

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

    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

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

Yields:

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

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

    def get_connection
      if block_given?
        @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) }))
        return self
      end
      raise ArgumentError, "Invalid arguments when calling get_connection()"
    end

### - (`self`) query(sql = nil) { ... }

Parameters:

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

Yields:

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    81
    82
    83
    84
    85
    86
    87
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-mysql-postgresql/postgre_sql_client.rb', line 81

    def query(sql=nil)
      if sql.class == String && block_given?
        @j_del.java_method(:query, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(sql,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result != nil ? JSON.parse(ar.result.toJson.encode) : nil : nil) }))
        return self
      end
      raise ArgumentError, "Invalid arguments when calling query(#{sql})"
    end

### - (`self`) query_single(sql = nil) { ... }

Parameters:

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

Yields:

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    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 41

    def query_single(sql=nil)
      if sql.class == String && block_given?
        @j_del.java_method(:querySingle, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(sql,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result != nil ? JSON.parse(ar.result.encode) : nil : nil) }))
        return self
      end
      raise ArgumentError, "Invalid arguments when calling query_single(#{sql})"
    end

### - (`self`) query_single_with_params(sql = nil, arguments = nil) { ... }

Parameters:

- sql (`String`) (defaults to: `nil`)
- arguments (`Array<String,Object>`) (defaults to: `nil`)

Yields:

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

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

    def query_single_with_params(sql=nil,arguments=nil)
      if sql.class == String && arguments.class == Array && block_given?
        @j_del.java_method(:querySingleWithParams, [Java::java.lang.String.java_class,Java::IoVertxCoreJson::JsonArray.java_class,Java::IoVertxCore::Handler.java_class]).call(sql,::Vertx::Util::Utils.to_json_array(arguments),(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result != nil ? JSON.parse(ar.result.encode) : nil : nil) }))
        return self
      end
      raise ArgumentError, "Invalid arguments when calling query_single_with_params(#{sql},#{arguments})"
    end

### - (`self`) query_with_params(sql = nil, arguments = nil) { ... }

Parameters:

- sql (`String`) (defaults to: `nil`)
- arguments (`Array<String,Object>`) (defaults to: `nil`)

Yields:

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    92
    93
    94
    95
    96
    97
    98
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-mysql-postgresql/postgre_sql_client.rb', line 92

    def query_with_params(sql=nil,arguments=nil)
      if sql.class == String && arguments.class == Array && block_given?
        @j_del.java_method(:queryWithParams, [Java::java.lang.String.java_class,Java::IoVertxCoreJson::JsonArray.java_class,Java::IoVertxCore::Handler.java_class]).call(sql,::Vertx::Util::Utils.to_json_array(arguments),(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result != nil ? JSON.parse(ar.result.toJson.encode) : nil : nil) }))
        return self
      end
      raise ArgumentError, "Invalid arguments when calling query_with_params(#{sql},#{arguments})"
    end

### - (`self`) update(sql = nil) { ... }

Parameters:

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

Yields:

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    102
    103
    104
    105
    106
    107
    108
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-mysql-postgresql/postgre_sql_client.rb', line 102

    def update(sql=nil)
      if sql.class == String && block_given?
        @j_del.java_method(:update, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(sql,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result != nil ? JSON.parse(ar.result.toJson.encode) : nil : nil) }))
        return self
      end
      raise ArgumentError, "Invalid arguments when calling update(#{sql})"
    end

### - (`self`) update_with_params(sql = nil, params = nil) { ... }

Parameters:

- sql (`String`) (defaults to: `nil`)
- params (`Array<String,Object>`) (defaults to: `nil`)

Yields:

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    113
    114
    115
    116
    117
    118
    119
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-mysql-postgresql/postgre_sql_client.rb', line 113

    def update_with_params(sql=nil,params=nil)
      if sql.class == String && params.class == Array && block_given?
        @j_del.java_method(:updateWithParams, [Java::java.lang.String.java_class,Java::IoVertxCoreJson::JsonArray.java_class,Java::IoVertxCore::Handler.java_class]).call(sql,::Vertx::Util::Utils.to_json_array(params),(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result != nil ? JSON.parse(ar.result.toJson.encode) : nil : nil) }))
        return self
      end
      raise ArgumentError, "Invalid arguments when calling update_with_params(#{sql},#{params})"
    end