Sha256: 64d4483e15bfa6679a21cb93bcbcb623a8a4a10c1f235313082936873c9f714a

Contents?: true

Size: 518 Bytes

Versions: 1

Compression:

Stored size: 518 Bytes

Contents

begin
  require 'mysql2/em'
rescue LoadError => error
  raise 'Missing EM-Synchrony dependency: gem install mysql2'
end

module Mysql2
  module EM
    class Client

      alias :aquery :query
      def query(sql, opts={})
        deferable = aquery(sql, opts)

        f = Fiber.current
        deferable.callback { |res| f.resume(res) }
        deferable.errback  { |err| f.resume(err) }

        Fiber.yield.tap do |result|
          raise result if result.is_a?(::Exception)
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
em-synchrony-1.0.0 lib/em-synchrony/mysql2.rb