class EventMachine::Protocols::Postgres3

def query sql

def query sql
  d = EM::DefaultDeferrable.new
  d.timeout 15
  if @pending_query || @pending_conn
    d.succeed false, "Operation already in progress"
  else
    @r = PostgresPR::Connection::Result.new
    @e = []
    @pending_query = d
    send_data PostgresPR::Query.dump(sql)
  end
  d
end