Sha256: 7b193e70681e73a4481ff824dc70c22f04ceb100c434620a4d662c67d8e0fbf6

Contents?: true

Size: 559 Bytes

Versions: 2

Compression:

Stored size: 559 Bytes

Contents

begin
  require "mysqlplus"
  require "em-mysqlplus"
rescue LoadError => error
  raise "Missing EM-Synchrony dependency: gem install mysqlplus, gem install em-mysqlplus"
end

module EventMachine
  class MySQL

    alias :aquery :query
    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

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
em-synchrony-0.3.0.beta.1 lib/em-synchrony/em-mysqlplus.rb
em-synchrony-0.2.0 lib/em-synchrony/em-mysqlplus.rb