Execute a MQL read query
 @see https://developers.google.com/freebase/v1/mql-overview

 @param [Hash] query the MQL query
 @param [Hash] options the MQL query options
 @return [Hash] the response
556926
def mqlread(query, options={})
      params = { :query => query.to_json, :lang => "/lang/#{@query_options[:lang]}", :limit => @query_options[:limit] }.merge(options)
      response = get(surl('mqlread'), params, format: :json)
      response['result']
    end
498503
def query=(query)
      raise ArgumentError, "Invalid URL: #{self.url}" unless self.url.respond_to?(:query)
      if query.kind_of?(Hash)
        query = build_query_from_hash(query)
      end
      query = query.to_s unless query.is_a?(String)
      self.url.query = query
    end
470408
def option(*args)
      clone.tap do |query|
        unless args.compact.empty?
          yield(query.options, query)
        end
      end
    end
1284695
def raw_query(self, query, format=None, pretty=False):
        '''
        '''
        if format:
            format = format
        else:
            format = self.format

        payload = self._payload_builder(query, format=format)
        response = self.execute_query(payload)
        if pretty:
            response = self.response_builder(response)

        return response
1207654
def query_sort(query, options)
      query.order(options[:order]) if options[:order]
      query.order(options[:desc_order], :desc) if options[:desc_order]
      query
    end
198341
def build_query_string(options)
      options = camelcase_keys(options)
      
      query = ''

      options.each do |k,v|
        if k == :address
          if RUBY_VERSION.to_f >= 1.9
            if v.instance_of?(String)
              v.each_line { |address| query += "#{ '&' if query != '' }address=#{CGI.escape address}" }
            else
              v.each { |address| query += "#{ '&' if query != '' }address=#{CGI.escape address}" }
            end
          else
            v.each { |address| query += "#{ '&' if query != '' }address=#{CGI.escape address}" }
          end
        else
          query += "#{ '&' if query != '' }#{k.to_s}=#{CGI.escape v}"
        end
      end

      query
    end
187645
function Mql(query, values){
  var self = this;
  if(dynamicMatch){
    var mql = dynamicMatch.call(window, query);
    this.matches = mql.matches;
    this.media = mql.media;
    // TODO: is there a time it makes sense to remove this listener?
    mql.addListener(update);
  } else {
    this.matches = staticMatch(query, values);
    this.media = query;
  }

  this.addListener = addListener;
  this.removeListener = removeListener;
  this.dispose = dispose;

  function addListener(listener){
    if(mql){
      mql.addListener(listener);
    }
  }

  function removeListener(listener){
    if(mql){
      mql.removeListener(listener);
    }
  }

  // update ourselves!
  function update(evt){
    self.matches = evt.matches;
    self.media = evt.media;
  }

  function dispose(){
    mql.removeListener(update);
  }
}
1015003
function doQuery(options) {
            return models.Subscriber.getByEmail(options.data.subscribers[0].email)
                .then((subscriber) => {
                    if (subscriber && options.context.external) {
                        // we don't expose this information
                        return Promise.resolve(subscriber);
                    } else if (subscriber) {
                        return Promise.reject(new common.errors.ValidationError({message: common.i18n.t('errors.api.subscribers.subscriberAlreadyExists')}));
                    }

                    return models.Subscriber.add(options.data.subscribers[0], _.omit(options, ['data'])).catch((error) => {
                        if (error.code && error.message.toLowerCase().indexOf('unique') !== -1) {
                            return Promise.reject(new common.errors.ValidationError({message: common.i18n.t('errors.api.subscribers.subscriberAlreadyExists')}));
                        }

                        return Promise.reject(error);
                    });
                })
                .then((model) => {
                    return {
                        subscribers: [model.toJSON(options)]
                    };
                });
        }
347503
def query_options(query, options)
      query.ancestor(options[:ancestor]) if options[:ancestor]
      query.cursor(options[:cursor]) if options[:cursor]
      query.limit(options[:limit]) if options[:limit]
      query_sort(query, options)
      query.select(*options[:select]) if options[:select]
      query.distinct_on(*options[:distinct_on]) if options[:distinct_on]
      query_property_filter(query, options)
    end
905154
def method_missing(name, *args, &block)
      if queries.key?(name.to_sym)
        query = queries[name.to_sym]
        query.proc = block if block_given?
        query.options = args.extract_options!
        return query
      end

      super
    end
685918
def execute_cql_query(self, query, compression):
    
    self._seqid += 1
    d = self._reqs[self._seqid] = defer.Deferred()
    self.send_execute_cql_query(query, compression)
    return d
967206
def _execute_query(self):
        ''''''
        pipe = self.pipe
        if not self.card:
            if self.meta.ordering:
                self.ismember = getattr(self.backend.client, 'zrank')
                self.card = getattr(pipe, 'zcard')
                self._check_member = self.zism
            else:
                self.ismember = getattr(self.backend.client, 'sismember')
                self.card = getattr(pipe, 'scard')
                self._check_member = self.sism
        else:
            self.ismember = None
        self.card(self.query_key)
        result = yield pipe.execute()
        yield result[-1]
557485
def execute(self, query, params=None, cursor=None):
        
        conn = yield self._get_conn()
        try:
            cur = conn.cursor(cursor)
            yield cur.execute(query, params)
            yield cur.close()
        except:
            self._close_conn(conn)
            raise
        else:
            self._put_conn(conn)
        raise Return(cur)
1091945
public static function ExecuteQuery ($query, array $conditions = [], array $values = [], array $options = []) {
		$options += $options + static::GetDefaultOptions();
		return DBI::ExecuteQuery($query, $conditions, $values, $options);
	}
486671
function(query) {
        var self = this;
        return Q.ninvoke(fs, 'readdir', path.join(this.backend.options.path, this.name))
            .then(function(files) {
                return Q.all(files.map(function(f) {
                    return self.get(f);
                }));
            })
            .then(function(vals) {
                return _.query(vals, query);
            });
    }
1149076
function(options) {
        var params = {
          skip: this._skip,
          limit: this._limit,
        };

        return request({
          path: `/bigquery/jobs/${this.id}`,
          method: 'GET',
          query: params,
          authOptions: options,
          signKey: false,
        }).then(function(response) {
          if (response.error) {
            return Promise.reject(new AVError(response.code, response.error));
          }
          return Promise.resolve(response);
        });
      }
134332
def find_every_by_index(options={})
      # Construct the query. First add the type information.
      query =""

      # set default operator
      options[:operator] ||= :or

      # First add the conditions predicates
      conditions = options[:conditions]
      if conditions.is_a?(String)
        query << conditions
      elsif conditions.is_a?(Array) and !conditions.empty?
        nb_conditions = conditions.size - 1
        i = 0
        query << conditions[0].gsub(/\?/) do |c|
          i += 1
          raise ArgumentError, "Missing condition argument" unless i <= nb_conditions
          "#{conditions[i]}"
        end
      elsif conditions.is_a?(Hash) and !conditions.empty?
        conditions.each do |k, v|
          query << "#{k}:#{v} "
        end
      end

      fields =
        if options[:fields]
          options[:fields]
        else
          fields = options[:view] ? index_views_hash[options[:view]] : index_views_hash[:default]
          fields ||= []
        end

      if options[:format] == :ids
        index_adapter.find_ids_by_index(self, query, {  :offset   => options[:offset],
                                                  :order    => options[:order],
                                                  :limit    => options[:limit],
                                                  :fields   => fields,
                                                  :operator => options[:operator],
                                                  :raw_result => options[:raw_result]})
      else
        index_adapter.find_by_index(self, query, {  :offset   => options[:offset],
                                              :order    => options[:order],
                                              :limit    => options[:limit],
                                              :operator => options[:operator],
                                              :raw_result => options[:raw_result]})
      end

    end