Class: VertxPgClient::PgPool

Inherits:
VertxSqlClient::Pool show all
Defined in:
/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-pg-client/pg_pool.rb

Overview

A pool of PostgreSQL connections.

Constant Summary

@@j_api_type =
Object.new

Class Method Summary (collapse)

Instance Method Summary (collapse)

Class Method Details

+ (Boolean) accept?(obj)

Returns:

  • (Boolean)

22
23
24
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-pg-client/pg_pool.rb', line 22

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

+ (Object) j_api_type


31
32
33
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-pg-client/pg_pool.rb', line 31

def self.j_api_type
  @@j_api_type
end

+ (Object) j_class


34
35
36
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-pg-client/pg_pool.rb', line 34

def self.j_class
  Java::IoVertxPgclient::PgPool.java_class
end

+ (::VertxPgClient::PgPool) pool + (::VertxPgClient::PgPool) pool(poolOptions) + (::VertxPgClient::PgPool) pool(connectionUri) + (::VertxPgClient::PgPool) pool(connectionUri, poolOptions) + (::VertxPgClient::PgPool) pool(vertx, connectionUri) + (::VertxPgClient::PgPool) pool(vertx, poolOptions) + (::VertxPgClient::PgPool) pool(connectOptions, poolOptions) + (::VertxPgClient::PgPool) pool(vertx, connectionUri, poolOptions) + (::VertxPgClient::PgPool) pool(vertx, connectOptions, poolOptions)

Like #pool with a specific instance.

Overloads:

Returns:

Raises:

  • (ArgumentError)

91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-pg-client/pg_pool.rb', line 91

def self.pool(param_1=nil,param_2=nil,param_3=nil)
  if !block_given? && param_1 == nil && param_2 == nil && param_3 == nil
    return ::Vertx::Util::Utils.safe_create(Java::IoVertxPgclient::PgPool.java_method(:pool, []).call(),::VertxPgClient::PgPool)
  elsif param_1.class == Hash && !block_given? && param_2 == nil && param_3 == nil
    return ::Vertx::Util::Utils.safe_create(Java::IoVertxPgclient::PgPool.java_method(:pool, [Java::IoVertxSqlclient::PoolOptions.java_class]).call(Java::IoVertxSqlclient::PoolOptions.new(::Vertx::Util::Utils.to_json_object(param_1))),::VertxPgClient::PgPool)
  elsif param_1.class == String && !block_given? && param_2 == nil && param_3 == nil
    return ::Vertx::Util::Utils.safe_create(Java::IoVertxPgclient::PgPool.java_method(:pool, [Java::java.lang.String.java_class]).call(param_1),::VertxPgClient::PgPool)
  elsif param_1.class == String && param_2.class == Hash && !block_given? && param_3 == nil
    return ::Vertx::Util::Utils.safe_create(Java::IoVertxPgclient::PgPool.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))),::VertxPgClient::PgPool)
  elsif param_1.class.method_defined?(:j_del) && param_2.class == String && !block_given? && param_3 == nil
    return ::Vertx::Util::Utils.safe_create(Java::IoVertxPgclient::PgPool.java_method(:pool, [Java::IoVertxCore::Vertx.java_class,Java::java.lang.String.java_class]).call(param_1.j_del,param_2),::VertxPgClient::PgPool)
  elsif param_1.class.method_defined?(:j_del) && param_2.class == Hash && !block_given? && param_3 == nil
    return ::Vertx::Util::Utils.safe_create(Java::IoVertxPgclient::PgPool.java_method(:pool, [Java::IoVertxCore::Vertx.java_class,Java::IoVertxSqlclient::PoolOptions.java_class]).call(param_1.j_del,Java::IoVertxSqlclient::PoolOptions.new(::Vertx::Util::Utils.to_json_object(param_2))),::VertxPgClient::PgPool)
  elsif param_1.class == Hash && param_2.class == Hash && !block_given? && param_3 == nil
    return ::Vertx::Util::Utils.safe_create(Java::IoVertxPgclient::PgPool.java_method(:pool, [Java::IoVertxPgclient::PgConnectOptions.java_class,Java::IoVertxSqlclient::PoolOptions.java_class]).call(Java::IoVertxPgclient::PgConnectOptions.new(::Vertx::Util::Utils.to_json_object(param_1)),Java::IoVertxSqlclient::PoolOptions.new(::Vertx::Util::Utils.to_json_object(param_2))),::VertxPgClient::PgPool)
  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::IoVertxPgclient::PgPool.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))),::VertxPgClient::PgPool)
  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::IoVertxPgclient::PgPool.java_method(:pool, [Java::IoVertxCore::Vertx.java_class,Java::IoVertxPgclient::PgConnectOptions.java_class,Java::IoVertxSqlclient::PoolOptions.java_class]).call(param_1.j_del,Java::IoVertxPgclient::PgConnectOptions.new(::Vertx::Util::Utils.to_json_object(param_2)),Java::IoVertxSqlclient::PoolOptions.new(::Vertx::Util::Utils.to_json_object(param_3))),::VertxPgClient::PgPool)
  end
  raise ArgumentError, "Invalid arguments when calling pool(#{param_1},#{param_2},#{param_3})"
end

+ (Object) unwrap(obj)


28
29
30
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-pg-client/pg_pool.rb', line 28

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

+ (Object) wrap(obj)


25
26
27
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-pg-client/pg_pool.rb', line 25

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

50
51
52
53
54
55
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-pg-client/pg_pool.rb', line 50

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)

58
59
60
61
62
63
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-pg-client/pg_pool.rb', line 58

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)

40
41
42
43
44
45
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-pg-client/pg_pool.rb', line 40

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

- (self) prepared_batch(sql = nil, batch = nil) { ... }

Parameters:

Yields:

Returns:

  • (self)

Raises:

  • (ArgumentError)

141
142
143
144
145
146
147
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-pg-client/pg_pool.rb', line 141

def prepared_batch(sql=nil,batch=nil)
  if sql.class == String && batch.class == Array && block_given?
    @j_del.java_method(:preparedBatch, [Java::java.lang.String.java_class,Java::JavaUtil::List.java_class,Java::IoVertxCore::Handler.java_class]).call(sql,batch.map { |element| element.j_del },(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxSqlClient::RowSet) : nil) }))
    return self
  end
  raise ArgumentError, "Invalid arguments when calling prepared_batch(#{sql},#{batch})"
end

- (self) prepared_query(sql = nil, arguments = nil) { ... }

Parameters:

Yields:

Returns:

  • (self)

Raises:

  • (ArgumentError)

117
118
119
120
121
122
123
124
125
126
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-pg-client/pg_pool.rb', line 117

def prepared_query(sql=nil,arguments=nil)
  if sql.class == String && block_given? && arguments == nil
    @j_del.java_method(:preparedQuery, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(sql,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxSqlClient::RowSet) : nil) }))
    return self
  elsif sql.class == String && arguments.class.method_defined?(:j_del) && block_given?
    @j_del.java_method(:preparedQuery, [Java::java.lang.String.java_class,Java::IoVertxSqlclient::Tuple.java_class,Java::IoVertxCore::Handler.java_class]).call(sql,arguments.j_del,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxSqlClient::RowSet) : nil) }))
    return self
  end
  raise ArgumentError, "Invalid arguments when calling prepared_query(#{sql},#{arguments})"
end

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

Parameters:

  • sql (String) (defaults to: nil)

Yields:

Returns:

  • (self)

Raises:

  • (ArgumentError)

130
131
132
133
134
135
136
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-pg-client/pg_pool.rb', line 130

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 ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxSqlClient::RowSet) : nil) }))
    return self
  end
  raise ArgumentError, "Invalid arguments when calling query(#{sql})"
end