Class: VertxMysqlPostgresql::MySQLClient

Inherits:
AsyncSQLClient show all
Defined in:
/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-mysql-postgresql/my_sql_client.rb

Overview

Represents an asynchronous MySQL client

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-stack/stack-docs/target/rb/vertx-mysql-postgresql/my_sql_client.rb', line 22

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

+ (::VertxMysqlPostgresql::AsyncSQLClient) create_non_shared(vertx = nil, config = nil)

Create a MySQL 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:

Raises:

  • (ArgumentError)


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

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::MySQLClient.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 MySQL client which shares its data source with any other MySQL 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
  • poolName (String) (defaults to: nil)
    the pool name

Returns:

Raises:

  • (ArgumentError)


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

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::MySQLClient.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::MySQLClient.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



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

def self.j_api_type
  @@j_api_type
end

+ (Object) j_class



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

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

+ (Object) unwrap(obj)



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

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

+ (Object) wrap(obj)



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

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

Instance Method Details

- (void) close { ... }

This method returns an undefined value.

Yields:

Raises:

  • (ArgumentError)


48
49
50
51
52
53
54
55
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-mysql-postgresql/my_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 { ... }

Yields:

Returns:

  • (self)

Raises:

  • (ArgumentError)


39
40
41
42
43
44
45
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-mysql-postgresql/my_sql_client.rb', line 39

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