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, default_query_options, #encoding, escape, #escape, #info, #initialize, #last_id, #more_results?, #next_result, #ping, #query_info, #query_info_string, #reconnect=, #select_db, #server_info, #socket, #store_result, #thread_id, #warning_count
Constructor Details
This class inherits a constructor from Mysql2::Client
Instance Method Details
#close(*args) ⇒ Object
27 28 29 30 31 32 |
# File 'lib/mysql2/em.rb', line 27 def close(*args) if @watch @watch.detach end super(*args) end |
#query(sql, opts = {}) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/mysql2/em.rb', line 34 def query(sql, opts={}) if ::EM.reactor_running? super(sql, opts.merge(:async => true)) deferable = ::EM::DefaultDeferrable.new @watch = ::EM.watch(self.socket, Watcher, self, deferable) @watch.notify_readable = true deferable else super(sql, opts) end end |