class Mysql2::EM::Client - mysql2-0.4.9 Documentation

# class Mysql2::EM::Client

### Public Instance Methods

close(*args) click to toggle source
Calls superclass method Mysql2::Client#close

    # File lib/mysql2/em.rb, line 35
    def close(*args)
      @watch.detach if @watch && @watch.watching?

      super(*args)
    end

query(sql, opts = {}) click to toggle source
Calls superclass method Mysql2::Client#query

    # File lib/mysql2/em.rb, line 41
    def query(sql, opts = {})
      if ::EM.reactor_running?
        super(sql, opts.merge(:async => true))
        deferable = ::EM::DefaultDeferrable.new
        @watch = ::EM.watch(socket, Watcher, self, deferable)
        @watch.notify_readable = true
        deferable
      else
        super(sql, opts)
      end
    end