Class: EventMachine::MySQL

Inherits:
Object
  • Object
show all
Defined in:
lib/em-synchrony/em-mysqlplus.rb

Instance Method Summary collapse

Instance Method Details

#aqueryObject



11
# File 'lib/em-synchrony/em-mysqlplus.rb', line 11

alias :aquery :query

#query(sql, &blk) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/em-synchrony/em-mysqlplus.rb', line 12

def query(sql, &blk)
  f = Fiber.current

  # TODO: blk case does not work. Hmm?
  cb = Proc.new { |r| f.resume(r) }
  eb = Proc.new { |r| f.resume(r) }

  @connection.execute(sql, cb, eb)

  result = Fiber.yield
  raise result if Mysql::Error == result.class
  result
end