Class: VertxPgClient::PgConnection
- Inherits:
-
VertxSqlClient::SqlConnection
- Object
- VertxSqlClient::SqlClient
- VertxSqlClient::SqlConnection
- VertxPgClient::PgConnection
- Defined in:
- /Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-pg-client/pg_connection.rb
Overview
A connection to Postgres.
Constant Summary
- @@j_api_type =
Object.new
Class Method Summary (collapse)
- + (Boolean) accept?(obj)
-
+ (void) connect(*args)
Like #connect with options build from connectionUri.
- + (Object) j_api_type
- + (Object) j_class
- + (Object) unwrap(obj)
- + (Object) wrap(obj)
Instance Method Summary (collapse)
-
- (::VertxPgClient::PgConnection) cancelRequest(handler) { ... }
Send a request cancellation message to tell the server to cancel processing request in this connection.
- - (self) closeHandler(handler) { ... }
- - (self) exceptionHandler(handler) { ... }
-
- (self) notificationHandler(handler) { ... }
Set an handler called when the connection receives notification on a channel.
- - (self) prepare(sql, handler) { ... }
- - (self) preparedBatch(sql, batch, handler) { ... }
- - (self) prepared_query(*args)
-
- (Fixnum) processId
The process ID of the target backend.
- - (self) query(sql, handler) { ... }
-
- (Fixnum) secretKey
The secret key for the target backend.
Methods inherited from VertxSqlClient::SqlConnection
Methods inherited from VertxSqlClient::SqlClient
Class Method Details
+ (Boolean) accept?(obj)
25 26 27 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-pg-client/pg_connection.rb', line 25 def @@j_api_type.accept?(obj) obj.class == PgConnection end |
+ (void) connect(vertx, handler) { ... } + (void) connect(vertx, options, handler) { ... } + (void) connect(vertx, connectionUri, handler) { ... }
This method returns an undefined value.
Like #connect with options build fromconnectionUri.
202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-pg-client/pg_connection.rb', line 202 def self.connect(*args) if args[0].class.method_defined?(:j_del) && true && args[1] == nil if (block_given?) return Java::IoVertxPgclient::PgConnection.java_method(:connect, [Java::IoVertxCore::Vertx.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0].j_del,block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxPgClient::PgConnection) : nil) } : promise) else promise = ::Vertx::Util::Utils.promise Java::IoVertxPgclient::PgConnection.java_method(:connect, [Java::IoVertxCore::Vertx.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0].j_del,block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxPgClient::PgConnection) : nil) } : promise) return ::Vertx::Util::Utils.safe_create(promise.future(),::Vertx::Future,::VertxPgClient::PgConnection.j_api_type) end elsif args[0].class.method_defined?(:j_del) && args[1].class == Hash && true if (block_given?) return Java::IoVertxPgclient::PgConnection.java_method(:connect, [Java::IoVertxCore::Vertx.java_class,Java::IoVertxPgclient::PgConnectOptions.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0].j_del,Java::IoVertxPgclient::PgConnectOptions.new(::Vertx::Util::Utils.to_json_object(args[1])),block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxPgClient::PgConnection) : nil) } : promise) else promise = ::Vertx::Util::Utils.promise Java::IoVertxPgclient::PgConnection.java_method(:connect, [Java::IoVertxCore::Vertx.java_class,Java::IoVertxPgclient::PgConnectOptions.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0].j_del,Java::IoVertxPgclient::PgConnectOptions.new(::Vertx::Util::Utils.to_json_object(args[1])),block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxPgClient::PgConnection) : nil) } : promise) return ::Vertx::Util::Utils.safe_create(promise.future(),::Vertx::Future,::VertxPgClient::PgConnection.j_api_type) end elsif args[0].class.method_defined?(:j_del) && args[1].class == String && true if (block_given?) return Java::IoVertxPgclient::PgConnection.java_method(:connect, [Java::IoVertxCore::Vertx.java_class,Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0].j_del,args[1],block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxPgClient::PgConnection) : nil) } : promise) else promise = ::Vertx::Util::Utils.promise Java::IoVertxPgclient::PgConnection.java_method(:connect, [Java::IoVertxCore::Vertx.java_class,Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0].j_del,args[1],block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxPgClient::PgConnection) : nil) } : promise) return ::Vertx::Util::Utils.safe_create(promise.future(),::Vertx::Future,::VertxPgClient::PgConnection.j_api_type) end end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling connect(#{args[0]},#{args[1]})" end end |
+ (Object) j_api_type
34 35 36 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-pg-client/pg_connection.rb', line 34 def self.j_api_type @@j_api_type end |
+ (Object) j_class
37 38 39 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-pg-client/pg_connection.rb', line 37 def self.j_class Java::IoVertxPgclient::PgConnection.java_class end |
+ (Object) unwrap(obj)
31 32 33 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-pg-client/pg_connection.rb', line 31 def @@j_api_type.unwrap(obj) obj.j_del end |
+ (Object) wrap(obj)
28 29 30 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-pg-client/pg_connection.rb', line 28 def @@j_api_type.wrap(obj) PgConnection.new(obj) end |
Instance Method Details
- (::VertxPgClient::PgConnection) cancelRequest(handler) { ... }
Send a request cancellation message to tell the server to cancel processing request in this connection.
Note: Use this with caution because the cancellation signal may or may not have any effect.
Note: Use this with caution because the cancellation signal may or may not have any effect.
133 134 135 136 137 138 139 140 141 142 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-pg-client/pg_connection.rb', line 133 def cancel_request if true return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:cancelRequest, [Java::IoVertxCore::Handler.java_class]).call(block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? nil : nil) } : promise),::VertxPgClient::PgConnection) end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling cancel_request()" end end |
- (self) closeHandler(handler) { ... }
164 165 166 167 168 169 170 171 172 173 174 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-pg-client/pg_connection.rb', line 164 def close_handler if true @j_del.java_method(:closeHandler, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(nil) unless !block_given? })) return self end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling close_handler()" end end |
- (self) exceptionHandler(handler) { ... }
178 179 180 181 182 183 184 185 186 187 188 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-pg-client/pg_connection.rb', line 178 def exception_handler if true @j_del.java_method(:exceptionHandler, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(::Vertx::Util::Utils.from_throwable(event)) unless !block_given? })) return self end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling exception_handler()" end end |
- (self) notificationHandler(handler) { ... }
Set an handler called when the connection receives notification on a channel.
The handler is called with the => Object} and has access to the channel name
and the notification payload.
150 151 152 153 154 155 156 157 158 159 160 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-pg-client/pg_connection.rb', line 150 def notification_handler if true @j_del.java_method(:notificationHandler, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(event != nil ? JSON.parse(event.toJson.encode) : nil) unless !block_given? })) return self end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling notification_handler()" end end |
- (self) prepare(sql, handler) { ... }
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-pg-client/pg_connection.rb', line 44 def prepare(*args) if args[0].class == String && true if (block_given?) @j_del.java_method(:prepare, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0],block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxSqlClient::PreparedQuery) : nil) } : promise) return self else promise = ::Vertx::Util::Utils.promise @j_del.java_method(:prepare, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0],block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxSqlClient::PreparedQuery) : nil) } : promise) return ::Vertx::Util::Utils.safe_create(promise.future(),::Vertx::Future,::VertxSqlClient::PreparedQuery.j_api_type) end end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling prepare(#{args[0]})" end end |
- (self) preparedBatch(sql, batch, handler) { ... }
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-pg-client/pg_connection.rb', line 78 def prepared_batch(*args) if args[0].class == String && args[1].class == Array && true if (block_given?) @j_del.java_method(:preparedBatch, [Java::java.lang.String.java_class,Java::JavaUtil::List.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0],args[1].map { |element| element.j_del },block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxSqlClient::RowSet,::VertxSqlClient::Row.j_api_type) : nil) } : promise) return self else promise = ::Vertx::Util::Utils.promise @j_del.java_method(:preparedBatch, [Java::java.lang.String.java_class,Java::JavaUtil::List.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0],args[1].map { |element| element.j_del },block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxSqlClient::RowSet,::VertxSqlClient::Row.j_api_type) : nil) } : promise) return ::Vertx::Util::Utils.safe_create(promise.future(),::Vertx::Future,::VertxSqlClient::RowSet.j_api_type) end end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling prepared_batch(#{args[0]},#{args[1]})" end end |
- (self) preparedQuery(sql, handler) { ... } - (self) preparedQuery(sql, arguments, handler) { ... }
242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-pg-client/pg_connection.rb', line 242 def prepared_query(*args) if args[0].class == String && true && args[1] == nil if (block_given?) @j_del.java_method(:preparedQuery, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0],block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxSqlClient::RowSet,::VertxSqlClient::Row.j_api_type) : nil) } : promise) return self else promise = ::Vertx::Util::Utils.promise @j_del.java_method(:preparedQuery, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0],block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxSqlClient::RowSet,::VertxSqlClient::Row.j_api_type) : nil) } : promise) return ::Vertx::Util::Utils.safe_create(promise.future(),::Vertx::Future,::VertxSqlClient::RowSet.j_api_type) end elsif args[0].class == String && args[1].class.method_defined?(:j_del) && true if (block_given?) @j_del.java_method(:preparedQuery, [Java::java.lang.String.java_class,Java::IoVertxSqlclient::Tuple.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0],args[1].j_del,block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxSqlClient::RowSet,::VertxSqlClient::Row.j_api_type) : nil) } : promise) return self else promise = ::Vertx::Util::Utils.promise @j_del.java_method(:preparedQuery, [Java::java.lang.String.java_class,Java::IoVertxSqlclient::Tuple.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0],args[1].j_del,block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxSqlClient::RowSet,::VertxSqlClient::Row.j_api_type) : nil) } : promise) return ::Vertx::Util::Utils.safe_create(promise.future(),::Vertx::Future,::VertxSqlClient::RowSet.j_api_type) end end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling prepared_query(#{args[0]},#{args[1]})" end end |
- (Fixnum) processId
Returns The process ID of the target backend
97 98 99 100 101 102 103 104 105 106 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-pg-client/pg_connection.rb', line 97 def process_id if !block_given? return @j_del.java_method(:processId, []).call() end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling process_id()" end end |
- (self) query(sql, handler) { ... }
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-pg-client/pg_connection.rb', line 111 def query(*args) if args[0].class == String && true if (block_given?) @j_del.java_method(:query, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0],block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxSqlClient::RowSet,::VertxSqlClient::Row.j_api_type) : nil) } : promise) return self else promise = ::Vertx::Util::Utils.promise @j_del.java_method(:query, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0],block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxSqlClient::RowSet,::VertxSqlClient::Row.j_api_type) : nil) } : promise) return ::Vertx::Util::Utils.safe_create(promise.future(),::Vertx::Future,::VertxSqlClient::RowSet.j_api_type) end end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling query(#{args[0]})" end end |
- (Fixnum) secretKey
Returns The secret key for the target backend
63 64 65 66 67 68 69 70 71 72 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-pg-client/pg_connection.rb', line 63 def secret_key if !block_given? return @j_del.java_method(:secretKey, []).call() end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling secret_key()" end end |