Class: VertxSql::SQLClient

Inherits:
Object
  • Object
show all
Defined in:
/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-sql/sql_client.rb

Overview

A common asynchronous client interface for interacting with SQL compliant database

Direct Known Subclasses

VertxJdbc::JDBCClient, VertxMysqlPostgresql::AsyncSQLClient

Constant Summary

@@j_api_type =
Object.new

Class Method Summary (collapse)

Instance Method Summary (collapse)

Class Method Details

+ (Boolean) accept?(obj)

Returns:

  • (Boolean)


18
19
20
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-sql/sql_client.rb', line 18

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

+ (Object) j_api_type



27
28
29
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-sql/sql_client.rb', line 27

def self.j_api_type
  @@j_api_type
end

+ (Object) j_class



30
31
32
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-sql/sql_client.rb', line 30

def self.j_class
  Java::IoVertxExtSql::SQLClient.java_class
end

+ (Object) unwrap(obj)



24
25
26
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-sql/sql_client.rb', line 24

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

+ (Object) wrap(obj)



21
22
23
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-sql/sql_client.rb', line 21

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

  • the handler that will be called when close is complete

Raises:

  • (ArgumentError)


48
49
50
51
52
53
54
55
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-sql/sql_client.rb', line 48

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 { ... }

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.

Returns:

  • (self)

Raises:

  • (ArgumentError)


37
38
39
40
41
42
43
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-sql/sql_client.rb', line 37

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