Find field.

@param object   the object
@param strategy the strategy
@param where    the where
@return the field
335247
private static Field findField(Object object, FieldMatcherStrategy strategy, Class<?> where) {
        return findSingleFieldUsingStrategy(strategy, object, false, where);
    }
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
799538
protected function _doFind(Model $model, array $where, $type = 'first') {
        $virtual = $model->virtualFields;
        $model->virtualFields = array();

        $results = $model->find($type, array(
            'conditions' => $where,
            'contain' => false,
            'recursive' => -1,
            'order' => ''
        ));

        $model->virtualFields = $virtual;

        return $results;
    }
194512
private static Field getField(String fieldName, Class<?> where) {
        if (where == null) {
            throw new IllegalArgumentException("where cannot be null");
        }

        Field field = null;
        try {
            field = where.getDeclaredField(fieldName);
            field.setAccessible(true);
        } catch (NoSuchFieldException e) {
            throw new FieldNotFoundException("Field '" + fieldName + "' was not found in class " + where.getName()
                                                     + ".");
        }
        return field;
    }
635440
public function findWhere(array $where, $columns = ['*'])
    {
        $this->newQuery();

        foreach ($where as $field => $value) {
            if (is_array($value)) {
                list($field, $condition, $val) = $value;
                $this->query->where($field, $condition, $val);
            }
            else {
                $this->query->where($field, '=', $value);
            }
        }

        return $this->query->get($columns);
    }
125062
public function hasWhere($where = [], $fields = null)
    {
        $table    = $this->query->getTable();
        $model    = basename(str_replace('\\', '/', get_class($this->parent)));
        $relation = basename(str_replace('\\', '/', $this->model));

        if (is_array($where)) {
            $this->getQueryWhere($where, $relation);
        }

        $fields = $this->getRelationQueryFields($fields, $model);

        return $this->parent->db()
            ->alias($model)
            ->field($fields)
            ->join($table . ' ' . $relation, $model . '.' . $this->localKey . '=' . $relation . '.' . $this->foreignKey)
            ->where($where);
    }
80577
protected function getTableFieldInformationWhere(Where $where)
    {
        $sql = <<<SQL
select
    att.attname      as "name",
    case
        when name.nspname = 'pg_catalog' then typ.typname
        else format('%s.%s', name.nspname, typ.typname)
    end as "type",
    def.adsrc        as "default",
    att.attnotnull   as "is_notnull",
    dsc.description  as "comment",
    att.attnum       as "position",
    att.attnum = any(ind.indkey) as "is_primary"
from
  pg_catalog.pg_attribute att
    join pg_catalog.pg_type  typ  on att.atttypid = typ.oid
    join pg_catalog.pg_class cla  on att.attrelid = cla.oid
    join pg_catalog.pg_namespace clns on cla.relnamespace = clns.oid
    left join pg_catalog.pg_description dsc on cla.oid = dsc.objoid and att.attnum = dsc.objsubid
    left join pg_catalog.pg_attrdef def     on att.attrelid = def.adrelid and att.attnum = def.adnum
    left join pg_catalog.pg_index ind       on cla.oid = ind.indrelid and ind.indisprimary
    left join pg_catalog.pg_namespace name  on typ.typnamespace = name.oid
where
{condition}
order by
    att.attnum
SQL;

        $where = $where
            ->andWhere('att.attnum > 0')
            ->andWhere('not att.attisdropped')
            ;

        return $this->executeSql($sql, $where);
    }
112981
def build_where_part(self, wheres):
        
        where_parts = []

        # loop through each child of the Q condition
        for where in wheres.children:

            # if this child is another Q object, recursively build the where part
            if type(where) is Q:
                where_parts.append(self.build_where_part(where))
            elif type(where) is tuple:
                # build the condition for this where part
                # get the field name and value
                field_name = where[0]
                value = where[1]

                # set the default operator
                operator_str = 'eq'
                operator = '='

                # break apart the field name on double underscores
                field_parts = field_name.split('__')
                if len(field_parts) > 1:
                    # get the operator based on the last element split from the double underscores
                    operator_str = field_parts[-1]
                    operator = self.get_condition_operator(operator_str)
                    if operator is None:
                        operator = '='
                        field_name = '__'.join(field_parts)
                    else:
                        field_name = '__'.join(field_parts[:-1])

                # check if we are comparing to null
                if value is None:
                    # change the operator syntax to IS
                    operator = 'IS'

                # set up the condition string format
                condition = '{0} {1} ?'.format(field_name, operator)

                # apply the NOT if this condition is negated
                if wheres.negated:
                    condition = 'NOT({0})'.format(condition)

                # check if this value is multiple values
                if operator_str == 'in':

                    # make sure value is a list
                    if type(value) is not list:

                        # convert to string in case it is a number
                        value = str(value)

                        # split on commas
                        value = value.split(',')

                    # Ensure that we have a value in the list
                    if len(value) == 0:
                        value = [None]

                    if type(value) is Expression:
                        condition = condition.replace('?', value.str)
                    else:
                        # assign each query param to a named arg
                        named_args = []
                        for value_item in value:
                            named_arg = self.set_arg(value_item)
                            named_args.append('%({0})s'.format(named_arg))
                        # replace the ? in the query with the arg placeholder
                        condition = condition.replace('?', '({0})'.format(','.join(named_args)), 1)
                else:
                    # get the value based on the operator
                    value = self.get_condition_value(operator_str, value)

                    if type(value) is Expression:
                        condition = condition.replace('?', value.str)
                    else:
                        named_arg = self.set_arg(value)
                        # replace the ? in the query with the arg placeholder
                        condition = condition.replace('?', '%({0})s'.format(named_arg), 1)

                # add the condition to the where sql
                where_parts.append(condition)

        # join all where parts together
        joined_parts = ' {0} '.format(wheres.connector).join(where_parts)

        # wrap the where parts in parentheses
        return '({0})'.format(joined_parts)
353579
private void setWhere(Where where) throws SqlParseException {
		if (where != null) {
			BoolQueryBuilder boolQuery = QueryMaker.explan(where,this.select.isQuery);
			request.setQuery(boolQuery);
		}
	}
1221779
def where(self, field, value = None, operator = None):
        
        if field is None:
            return self
        conjunction = None
        if value is None and isinstance(field, dict):
            for f,v in field.items():
                if self.where_criteria.size() > 0:
                    conjunction = 'AND'
                self.where_criteria.append(expressions.ConditionExpression(f, v, operator=operator, conjunction=conjunction))
                
        else:
            if self.where_criteria.size() > 0:
                    conjunction = 'AND'
            self.where_criteria.append(expressions.ConditionExpression(field, value, operator=operator, conjunction=conjunction))
        return self
1298921
public <T> List<T> find(Entity where, Class<T> beanClass) throws SQLException {
		return find(where.getFieldNames(), where, BeanListHandler.create(beanClass));
	}
828278
public function findElement($strategy, $selector)
	{
		return $this->element($this->using($strategy)->value($selector));
	}
227852
public Map<String, String> getUriVariablesForQuery(BullhornEntityInfo entityInfo, String where, Set<String> fieldSet, QueryParams params) {

		Map<String, String> uriVariables = params.getParameterMap();

		this.addCommonUriVariables(fieldSet, entityInfo, uriVariables);
		uriVariables.put(WHERE, where);

		return uriVariables;
	}
369164
def where(cls, where_clause="", start_position="", max_results="", qb=None):
        
        if where_clause:
            where_clause = "WHERE " + where_clause

        if start_position:
            start_position = " STARTPOSITION " + str(start_position)

        if max_results:
            max_results = " MAXRESULTS " + str(max_results)

        select = "SELECT * FROM {0} {1}{2}{3}".format(
            cls.qbo_object_name, where_clause, start_position, max_results)

        return cls.query(select, qb=qb)
1028122
public Entity get(Entity where) throws SQLException {
		return db.find(null, fixEntity(where), new EntityHandler());
	}
330855
public function assignWhereAppliers(WhereClauseStrategy $strategy)
    {
        if ($this->whereAppliers) {
            $items = $strategy->getWhere();

            $strategy->clearWhere();

            foreach ($this->whereAppliers as $applier) {
                $clause = $this->connection()->where();

                call_user_func_array($applier, [$clause]);

                $strategy->whereConditions($clause);
            }

            if ($items) {
                $clause = $this->connection()->where();

                foreach ($items as $where) {
                    $clause->addWhere($where['logic'], $where['sql'], $where['params']);
                }

                $strategy->whereConditions($clause);
            }
        }

        return $this;
    }
1049786
public static boolean isField(Schema schema, PartitionStrategy strategy,
                                String name) {
    Schema.Field field = schema.getField(name);
    return ((field != null) ||
        (strategy != null && Accessor.getDefault().hasPartitioner(strategy, name)));
  }