123456789_123456789_123456789_123456789_123456789_

Class: Mysql2::EM::Client

Relationships & Source Files
Namespace Children
Modules:
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
Instance Chain:
Inherits: Mysql2::Client
Defined in: lib/mysql2/em.rb

Class Method Summary

::Mysql2::Client - Inherited

.default_query_options,
.escape

Escape string so that it may be used in a SQL statement.

.info

Returns a string that represents the client library version.

.new, .local_offset

Instance Attribute Summary

::Mysql2::Client - Inherited

#automatic_close=

Set this to false to leave the connection open after it is garbage collected.

#automatic_close?, #closed?,
#more_results?

Returns true or false if there are more results to process.

#query_options, #read_timeout,
#reconnect=

Enable or disable the automatic reconnect behavior of libmysql.

#charset_name=, #connect_timeout=, #default_auth=, #default_file=, #default_group=, #enable_cleartext_plugin=, #init_command=, #local_infile=, #read_timeout=, #secure_auth=, #ssl_mode=, #write_timeout=

Instance Method Summary

::Mysql2::Client - Inherited

#abandon_results!

When using MULTI_STATEMENTS support, calling this will throw away any unprocessed results as fast as it can in order to put the connection back into a state where queries can be issued again.

#affected_rows

returns the number of rows changed, deleted, or inserted by the last statement if it was an UPDATE, DELETE, or INSERT.

#async_result

Returns the result for the last async issued query.

#close

Immediately disconnect from the server; normally the garbage collector will disconnect automatically when a connection is no longer needed.

#encoding

Returns the encoding set on the client.

#escape

Escape string so that it may be used in a SQL statement.

#find_default_ca_path

Find any default system CA paths to handle system roots by default if stricter validation is requested and no path is provide.

#info,
#last_id

Returns the value generated for an AUTO_INCREMENT column by the previous INSERT or UPDATE statement.

#next_result

Fetch the next result set from the server.

#parse_connect_attrs

Set default program_name in performance_schema.session_connect_attrs and performance_schema.session_account_connect_attrs.

#parse_flags_array, #parse_ssl_mode,
#ping

Checks whether the connection to the server is working.

#prepare

Create a new prepared statement.

#query, #query_info, #query_info_string,
#select_db

Causes the database specified by name to become the default (current) database on the connection specified by mysql.

#server_info

Returns a string that represents the server version number.

#session_track

Returns information about changes to the session state on the server.

#set_server_option

Enables or disables an option for the connection.

#socket, #ssl_cipher,
#store_result

Return the next result object from a query which yielded multiple result sets.

#thread_id

Returns the thread ID of the current connection.

#warning_count,
#_query

Query the database with sql, with optional options.

#connect, #initialize_ext, #ssl_set

Constructor Details

This class inherits a constructor from Mysql2::Client

Instance Method Details

#close(*args)

[ GitHub ]

  
# File 'lib/mysql2/em.rb', line 34

def close(*args)
  @watch.detach if @watch && @watch.watching?

  super(*args)
end

#query(sql, opts = {})

[ GitHub ]

  
# File 'lib/mysql2/em.rb', line 40

def query(sql, opts = {})
  if ::EM.reactor_running?
    super(sql, opts.merge(async: true))
    deferable = ::EM::DefaultDeferrable.new
    @watch = ::EM.watch(socket, Watcher, self, deferable)
    @watch.notify_readable = true
    deferable
  else
    super(sql, opts)
  end
end