Class: VertxJdbc::JDBCClient

Inherits:
VertxSql::SQLClient show all
Defined in:
/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-jdbc/jdbc_client.rb

Overview

An asynchronous client interface for interacting with a JDBC compliant database

Constant Summary

@@j_api_type =
Object.new

Class Method Summary (collapse)

Instance Method Summary (collapse)

Class Method Details

+ (Boolean) accept?(obj)

Returns:

  • (Boolean)


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

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

+ (::VertxJdbc::JDBCClient) create_non_shared(vertx = nil, config = nil)

Create a JDBC client which maintains its own data source.

Parameters:

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

Returns:

Raises:

  • (ArgumentError)


59
60
61
62
63
64
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-jdbc/jdbc_client.rb', line 59

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::IoVertxExtJdbc::JDBCClient.java_method(:createNonShared, [Java::IoVertxCore::Vertx.java_class,Java::IoVertxCoreJson::JsonObject.java_class]).call(vertx.j_del,::Vertx::Util::Utils.to_json_object(config)),::VertxJdbc::JDBCClient)
  end
  raise ArgumentError, "Invalid arguments when calling create_non_shared(#{vertx},#{config})"
end

+ (::VertxJdbc::JDBCClient) create_shared(vertx = nil, config = nil, dataSourceName = nil)

Create a JDBC client which shares its data source with any other JDBC clients created with the same data source name

Parameters:

  • vertx (::Vertx::Vertx) (defaults to: nil)
    the Vert.x instance
  • config (Hash{String => Object}) (defaults to: nil)
    the configuration
  • dataSourceName (String) (defaults to: nil)
    the data source name

Returns:

Raises:

  • (ArgumentError)


71
72
73
74
75
76
77
78
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-jdbc/jdbc_client.rb', line 71

def self.create_shared(vertx=nil,config=nil,dataSourceName=nil)
  if vertx.class.method_defined?(:j_del) && config.class == Hash && !block_given? && dataSourceName == nil
    return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtJdbc::JDBCClient.java_method(:createShared, [Java::IoVertxCore::Vertx.java_class,Java::IoVertxCoreJson::JsonObject.java_class]).call(vertx.j_del,::Vertx::Util::Utils.to_json_object(config)),::VertxJdbc::JDBCClient)
  elsif vertx.class.method_defined?(:j_del) && config.class == Hash && dataSourceName.class == String && !block_given?
    return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtJdbc::JDBCClient.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),dataSourceName),::VertxJdbc::JDBCClient)
  end
  raise ArgumentError, "Invalid arguments when calling create_shared(#{vertx},#{config},#{dataSourceName})"
end

+ (Object) j_api_type



30
31
32
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-jdbc/jdbc_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-jdbc/jdbc_client.rb', line 33

def self.j_class
  Java::IoVertxExtJdbc::JDBCClient.java_class
end

+ (Object) unwrap(obj)



27
28
29
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-jdbc/jdbc_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-jdbc/jdbc_client.rb', line 24

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

Instance Method Details

- (void) close { ... }

This method returns an undefined value.

Yields:

Raises:

  • (ArgumentError)


47
48
49
50
51
52
53
54
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-jdbc/jdbc_client.rb', line 47

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)


38
39
40
41
42
43
44
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-jdbc/jdbc_client.rb', line 38

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