Class: Mysql2::EM::Client

Inherits:
Client
  • Object
show all
Defined in:
lib/mysql2/em.rb

Defined Under Namespace

Modules: Watcher

Constant Summary

Constants inherited from Client

Client::CHARSET_MAP, Client::MYSQL_CHARSET_MAP

Instance Attribute Summary

Attributes inherited from Client

#query_options

Instance Method Summary collapse

Methods inherited from Client

#affected_rows, #async_result, #close, default_query_options, encoding_from_charset, encoding_from_charset_code, #escape, #info, #initialize, #last_id, #server_info, #socket

Constructor Details

This class inherits a constructor from Mysql2::Client

Instance Method Details

#query(sql, opts = {}) ⇒ Object



25
26
27
28
29
30
# File 'lib/mysql2/em.rb', line 25

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