Applies a query to the state machine.
551938
protected CompletableFuture<QueryResponse> applyQuery(QueryEntry entry, CompletableFuture<QueryResponse> future) {
    // In the case of the leader, the state machine is always up to date, so no queries will be queued and all query
    // indexes will be the last applied index.
    context.getStateMachine().<ServerStateMachine.Result>apply(entry).whenComplete((result, error) -> {
      completeOperation(result, QueryResponse.builder(), error, future);
      entry.release();
    });
    return future;
  }
1325082
private void sequenceQuery(QueryEntry entry, ServerSessionContext session, CompletableFuture<QueryResponse> future) {
    // If the query's sequence number is greater than the session's current sequence number, queue the request for
    // handling once the state machine is caught up.
    if (entry.getSequence() > session.getCommandSequence()) {
      session.registerSequenceQuery(entry.getSequence(), () -> indexQuery(entry, future));
    } else {
      indexQuery(entry, future);
    }
  }
385559
def match_query(query)
        query ||= {}
        
        if match_event(query) && (state_requirement = match_states(query))
          state_requirement.merge(:on => event_requirement)
        end
      end
1256241
def apply(self, query, value, alias):
        
        try:
            value = uuid.UUID(value)
            return query.filter(self.column == value)
        except ValueError:
            return query
552653
private void indexQuery(
      long index,
      long timestamp,
      RaftSession session,
      PrimitiveOperation operation,
      CompletableFuture<OperationResult> future) {
    // If the query index is greater than the session's last applied index, queue the request for handling once the
    // state machine is caught up.
    if (index > currentIndex) {
      log.trace("Registering query with index " + index + " > " + currentIndex);
      session.registerIndexQuery(index, () -> applyQuery(timestamp, session, operation, future));
    } else {
      applyQuery(timestamp, session, operation, future);
    }
  }
809607
public Iterable<DOAuth2User> queryByState(java.lang.Integer state) {
    return queryByField(null, DOAuth2UserMapper.Field.STATE.getFieldName(), state);
  }
981050
def run(self):
        """"""
        query = self.query

        # count before filtering
        self.cardinality = query.add_columns(self.columns[0].sqla_expr).count()

        self._set_column_filter_expressions()
        self._set_global_filter_expression()
        self._set_sort_expressions()
        self._set_yadcf_data(query)

        # apply filters
        query = query.filter(
            *[e for e in self.filter_expressions if e is not None])

        self.cardinality_filtered = query.add_columns(
            self.columns[0].sqla_expr).count()

        # apply sorts
        query = query.order_by(
            *[e for e in self.sort_expressions if e is not None])

        # add paging options
        length = int(self.params.get('length'))
        if length >= 0:
            query = query.limit(length)
        elif length == -1:
            pass
        else:
            raise (ValueError(
                'Length should be a positive integer or -1 to disable'))
        query = query.offset(int(self.params.get('start')))

        # add columns to query
        query = query.add_columns(*[c.sqla_expr for c in self.columns])

        # fetch the result of the queries
        column_names = [
            col.mData if col.mData else str(i)
            for i, col in enumerate(self.columns)
        ]
        self.results = [{k: v
                         for k, v in zip(column_names, row)}
                        for row in query.all()]
1076806
def setQuery(self, query):
        
        if not self.isVisible():
            self._loadQuery = query
        else:
            self._loadQuery = None
            
            if self._initialized and hash(query) == hash(self.query()):
                return
            
            self._initialized = True
            self.clear()
            self.addContainer(query)
555357
private function applyQueryFilters()
    {
        if (is_array($this->queryFilter())) {
            $this->createQueryFilter();
        } else {
            $this->queryFilter();
        }

        $this->queryFilterRequest();
    }
879660
protected void applyQueryFilter(Map<String, Object> params, QueryFilter queryFilter) {
    	if (queryFilter != null) {
    	    applyQueryContext(params, queryFilter);
        	if (queryFilter.getFilterParams() != null && !queryFilter.getFilterParams().isEmpty()) {
        		params.put(FILTER, queryFilter.getFilterParams());
        		for(String key : queryFilter.getParams().keySet()){
                    params.put(key, queryFilter.getParams().get(key));
                }
        	}
        }
    }
654799
function querySearch (query) {
      var results = query ? self.states.filter(createFilterFor(query)) : self.states,
          deferred;
      if (self.simulateQuery) {
        deferred = $q.defer();
        $timeout(function () { deferred.resolve(results); }, Math.random() * 1000, false);
        return deferred.promise;
      } else {
        return results;
      }
    }
211144
private void invokeQuery(PrimitiveOperation operation, CompletableFuture<byte[]> future) {
    QueryRequest request = QueryRequest.builder()
        .withSession(state.getSessionId().id())
        .withSequence(state.getCommandRequest())
        .withOperation(operation)
        .withIndex(Math.max(state.getResponseIndex(), state.getEventIndex()))
        .build();
    invokeQuery(request, future);
  }
969280
def setQuery(self, query, autoRefresh=False):
        
        self._query             = query
        self._currentRecordSet  = None
        
        if autoRefresh:
            self.refreshQueryRecords()
            self.refresh()
1307098
function BasicQuery(query) {
	assign(this, query);
	if (!this.filter) {
		this.filter = set.UNIVERSAL;
	}
	if (!this.page) {
		this.page = new RecordRange();
	}
	if (!this.sort) {
		this.sort = "id";
	}
	if (typeof this.sort === "string") {
		this.sort = new DefaultSort(this.sort);
	}
}
192912
function() {
    var self = this;
    var fsm = self.filterStateModel;
    var filter = fsm.getActiveFilter();
    if (filter) {
      self.trigger("filter:apply", filter.cid, filter);
    }
  }
1185724
def perform_query(self, query, **params):
        """"""
        try:
            return self.engine.execute(query, params)
        except:
            print("Error with query: {}".format(query))
            raise
1028809
private function compileQuery()
    {
        if ($this->queryConfiguration->isGlobalSearch()) {
            $this->compileGlobalQuery();
        } elseif ($this->queryConfiguration->isColumnSearch()) {
            $this->compileColumnQuery();
        }
    }