Evaluate the Where for the given relation, attribute, and parameter(s)
507564
def evaluate(relation, attributes, param)
      if splat_param?
        conditions = attributes.map {|a| a.send(predicate, *format_param(param))}
      else
        conditions = attributes.map {|a| a.send(predicate, format_param(param))}
      end

      relation.where(conditions.inject(nil) {|memo, c| memo ? memo.or(c) : c})
    end
155552
function exposeAttributes(collection) {
    function exposeModelAttributes(item) {
        // Make sure that relations are excluded
        return Object.assign(item, item.serialize({ shallow: true }));
    }
    if (collection) {
        if (collection.hasOwnProperty('length')) {
            return collection.map((item) => { return exposeModelAttributes(item); });
        }
        return exposeModelAttributes(collection);
    }
    return collection;
}
787995
def where(self, attrs, first=False):
        

        # from https://github.com/serkanyersen/underscore.py
        def by(val, *args):
            for key, value in attrs.items():
                try:
                    if attrs[key] != val[key]:
                        return False
                except KeyError:
                    return False
                return True

        if first:
            return list(filter(by, self.children))[0]
        else:
            return list(filter(by, self.children))
32543
protected function buildRelationQuery()
    {
        $args = func_get_args();

        list($relation, $args[0]) = explode('.', $this->column);

        return ['whereHas' => [$relation, function ($relation) use ($args) {
            call_user_func_array([$relation, $this->query], $args);
        }]];
    }
384691
def _match(self, x, op, y):
        
        if (op not in self.condition_mapper):
            raise ValueError('Invalid where condition given')

        func = getattr(self, self.condition_mapper.get(op))
        return func(x, y)
647179
function _filter (node, expr, resultSet) {
        var
            selectedNodes,
            conditions,
            type,
            idx,
            condition;
        if (expr.and) {
            conditions = expr.and;
            type = 0;
        } else if (expr.or) {
            conditions = expr.or;
            type = 1;
        }
        for (idx = 0; idx < conditions.length; ++idx) {
            condition = conditions[idx];
            if (condition.and || condition.or) {
                selectedNodes = [];
                _filter(node, condition, selectedNodes);
            } else {
                selectedNodes = _select(node, condition);
            }
            if (0 === type && selectedNodes.length === 0) {
                return;
            }
            if (1 === type && selectedNodes.length !== 0) {
                resultSet.push(node);
                return;
            }
        }
        if (0 === type) {
            resultSet.push(node);
        }
    }
442315
public function findWhere(array $where, $attributes = ['*'])
    {
        return $this->executeCallback(get_called_class(), __FUNCTION__, func_get_args(), function () use ($where, $attributes) {
            list($attribute, $operator, $value, $boolean) = array_pad($where, 4, null);

            $this->where($attribute, $operator, $value, $boolean);

            return $this->prepareQuery($this->createModel())->get($attributes);
        });
    }
1338836
def find(self, target, relation):
        '''  '''
        query = 'select ob1.code from objects as ob1, objects as ob2, relations where relations.dst=ob1.id and relations.name=? and relations.src=ob2.id and ob2.code=?' # src is id not source :/
        for i in self._execute(query, (relation, self.serialize(target))):
            yield self.deserialize(i[0])
1335378
function evaluateQuery(parent, query) {

	var container = getContainer(parent, query._prop);
	var qValues = query._values.slice(0);
	var i;

	var cValue;
	if (query._prop === 'width' || query._prop === 'height') {
		cValue = getSize(container, query._prop);
	}
	else {
		cValue = getComputedStyle(container).getPropertyValue(query._prop);
	}

	if (query._filter) {
		var color = parseColor(cValue);
		if (query._filter[0] === 'h') {
			cValue = color[0];
		}
		else if (query._filter[0] === 's') {
			cValue = color[1];
		}
		else if (query._filter[0] === 'l') {
			cValue = color[2];
		}
		else if (query._filter[0] === 'a') {
			cValue = color[3];
		}
		else {
			return false;
		}
	}
	else if (query._valueType === 'c') {
		cValue = parseColor(cValue).join(',');
	}
	else if (query._valueType === 'l') {
		for (i = 0; i < qValues.length; i++) {
			qValues[i] = getComputedLength(qValues[i], parent);
		}
		if (typeof cValue === 'string') {
			cValue = getComputedLength(cValue, parent);
		}
	}
	else if (query._valueType === 'n') {
		cValue = parseFloat(cValue);
	}
	else if (typeof cValue === 'string') {
		cValue = cValue.trim();
	}

	if ((
		query._types[0][0] === '>'
		|| query._types[0][0] === '<'
	) && (
		typeof cValue !== 'number'
		|| typeof qValues[0] !== 'number'
	)) {
		return false;
	}

	for (i = 0; i < qValues.length; i++) {
		if (!(
			(query._types[i] === '>=' && cValue >= qValues[i])
			|| (query._types[i] === '<=' && cValue <= qValues[i])
			|| (query._types[i] === '>' && cValue > qValues[i])
			|| (query._types[i] === '<' && cValue < qValues[i])
			|| (query._types[i] === '=' && cValue === qValues[i])
		)) {
			return false;
		}
	}

	return true;

}
1112784
function containsRelationships(query) {
  let contains = false;
  if (query.predicate instanceof SimplePredicate || query.predicate instanceof StringPredicate || query.predicate instanceof DatePredicate) {
    contains = Information.parseAttributePath(query.predicate.attributePath).length > 1;
  }

  if (query.predicate instanceof DetailPredicate) {
    return true;
  }

  if (query.predicate instanceof ComplexPredicate) {
    query.predicate.predicates.forEach((predicate) => {
      if (containsRelationships({ predicate })) {
        contains = true;
      }
    });
  }

  if (query.order) {
    for (let i = 0; i < query.order.length; i++) {
      let attributePath = query.order.attribute(i).name;
      if (Information.parseAttributePath(attributePath).length > 1) {
        contains = true;
      }
    }
  }

  return contains;
}
1260381
public function findWhereIn(array $where, $attributes = ['*'])
    {
        return $this->executeCallback(get_called_class(), __FUNCTION__, func_get_args(), function () use ($where, $attributes) {
            list($attribute, $values, $boolean, $not) = array_pad($where, 4, null);

            $this->whereIn($attribute, $values, $boolean, $not);

            return $this->prepareQuery($this->createModel())->get($attributes);
        });
    }
733559
def runWhere(self, whereAndTail, params = (), raw = False) :
		""""""
		
		sql = "SELECT %s.raba_id FROM %s WHERE %s" % (self.rabaClass.__name__, self.rabaClass.__name__, whereAndTail)
		cur = self.con.execute(sql, params)
		res = []
		for v in cur :
			if not raw :
				res.append(RabaPupa(self.rabaClass, v[0]))
			else :
				return v
		return res
14119
def _set_where(self):
        
        foreign = self.get_foreign_key()

        self._query.where(foreign, "=", self._parent.get_key())

        return self
14636
def where(self, field, value = None, operator = '='):
        
        if field is None:
            return self
        conjunction = None
        if value is None and isinstance(field, dict):
            for field, value in field.items():
                operator, value = value if isinstance(value, tuple) else ('=', value)
                self.where(field, value, operator)
        else:
            if self.where_criteria.size() > 0:
                    conjunction = 'AND'
            self.where_criteria.append(expressions.ConditionExpression(field, value, operator=operator, conjunction=conjunction))
        return self
215383
def matches_conditions?(object, query)
        query[:guard] == false ||
        Array(if_condition).all? {|condition| evaluate_method(object, condition)} &&
        !Array(unless_condition).any? {|condition| evaluate_method(object, condition)}
      end
224853
function where(column, operator, value) {

    // Support "where true || where false"
    if (column === false || column === true) {
      return this.where(1, '=', column ? 1 : 0);
    }

    // Check if the column is a function, in which case it's
    // a where statement wrapped in parens.
    if (typeof column === 'function') {
      return this.whereWrapped(column);
    }

    // Allow a raw statement to be passed along to the query.
    if (column instanceof Raw && arguments.length === 1) {
      return this.whereRaw(column);
    }

    // Allows `where({id: 2})` syntax.
    if (typeof column === 'object' && !(column instanceof Raw)) {
      return this._objectWhere(column);
    }

    // Enable the where('key', value) syntax, only when there
    // are explicitly two arguments passed, so it's not possible to
    // do where('key', '!=') and have that turn into where key != null
    if (arguments.length === 2) {
      value = operator;
      operator = '=';

      // If the value is null, and it's a two argument query,
      // we assume we're going for a `whereNull`.
      if (value === null) {
        return this.whereNull(column);
      }
    }

    // lower case the operator for comparison purposes
    var checkOperator = ('' + operator).toLowerCase().trim();

    // If there are 3 arguments, check whether 'in' is one of them.
    if (arguments.length === 3) {
      if (checkOperator === 'in' || checkOperator === 'not in') {
        return this._not(checkOperator === 'not in').whereIn(arguments[0], arguments[2]);
      }
      if (checkOperator === 'between' || checkOperator === 'not between') {
        return this._not(checkOperator === 'not between').whereBetween(arguments[0], arguments[2]);
      }
    }

    // If the value is still null, check whether they're meaning
    // where value is null
    if (value === null) {

      // Check for .where(key, 'is', null) or .where(key, 'is not', 'null');
      if (checkOperator === 'is' || checkOperator === 'is not') {
        return this._not(checkOperator === 'is not').whereNull(column);
      }
    }

    // Push onto the where statement stack.
    this._statements.push({
      grouping: 'where',
      type: 'whereBasic',
      column: column,
      operator: operator,
      value: value,
      not: this._not(),
      bool: this._bool()
    });
    return this;
  }
1191938
def _get_has_relation_query(self, relation):
        
        from .relations import Relation

        return Relation.no_constraints(
            lambda: getattr(self.get_model(), relation)()
        )