Class: Mysql2::EM::Client
Defined Under Namespace
Modules: Watcher
Instance Attribute Summary
Attributes inherited from Client
Instance Method Summary collapse
Methods inherited from Client
#abandon_results!, #affected_rows, #async_result, #automatic_close=, #automatic_close?, #closed?, default_query_options, #encoding, escape, #escape, #find_default_ca_path, #info, info, #initialize, #last_id, #more_results?, #next_result, #parse_connect_attrs, #parse_flags_array, #parse_ssl_mode, #ping, #prepare, #query_info, #query_info_string, #reconnect=, #select_db, #server_info, #session_track, #set_server_option, #socket, #ssl_cipher, #store_result, #thread_id, #warning_count
Constructor Details
This class inherits a constructor from Mysql2::Client
Instance Method Details
#close(*args) ⇒ Object
34 35 36 37 38 |
# File 'lib/mysql2/em.rb', line 34 def close(*args) @watch.detach if @watch && @watch.watching? super(*args) end |
#query(sql, opts = {}) ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 |
# 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 |