Get the number of occurrences of a column in where clauses.

@param  string $column
@return int
504496
protected function columnCountForWhereClause($column)
    {
        if (is_array($this->wheres))
            return count(array_filter($this->wheres, function($where) use($column) {
                return $where['column'] == $column;
            }));
    }
1104309
public function values($column) {
		$res = [];
		while($row = $this->next())
			$res[] = $row[$column];
		return $res;
	}
1085532
public function count($column, $alias)
    {
        return $this->addSelectColumn(new Func\Count(new Expr\Column($column)), $alias);
    }
43887
public function column($column = null)
	{
		if($column !== null)
		{
			$this->select([$column]);
		}

		$query = $this->limit(1)->compiler->select();

		return $this->connection->column($query['sql'], $query['params']);
	}
1090879
public function max(string $column): int
    {
        $max = $this->queryRelate->getQuery()->max($column);

        $this->resetQueryRelate();

        return $max;
    }
331691
public function avg($column)
    {
        $this->compileWheres();
        $result = $this->query->avg($column)
            ->rDefault(null)->run();

        return $result;
    }
477507
public function count(string $column = '*'): int
    {
        $count = $this->queryRelate->getQuery()->count($column);

        $this->resetQueryRelate();

        return $count;
    }
16906
public function avg($column)
    {
        $result = $this->getBuilder()->avg($column);

        // Reset query builder
        $this->resetBuilder();

        return $result;
    }
1346132
public function increments($column)
    {
        $result = parent::increments($column);
        $this->addCachePrimary($column);

        return $result;
    }
375987
public function countResults(string $table): int
    {
        $queryBuilder = $this->conn->createQueryBuilder();
        $rows = $queryBuilder->select('COUNT(1)')->from($table)->execute();

        return (int) $rows->fetch(\Doctrine\DBAL\FetchMode::NUMERIC)[0];
    }
1076024
public function getSelectionColumn($column)
        {
            if (isset($this->selections[$column])) {
                return $this->selections[$column]->getColumn();
            }

            foreach ($this->selections as $selection) {
                if ($selection->getAlias() == $column) {
                    return $column;
                }
            }

            list($table_name, $column_name) = (strpos($column, '.') !== false) ? explode('.', $column) : [$this->table->getB2DBName(), $column];

            if ($this->table->getB2DBAlias() == $table_name || $this->table->getB2DBName() == $table_name) {
                return $this->table->getB2DBAlias() . '.' . $column_name;
            } elseif (isset($this->joins[$table_name])) {
                return $this->joins[$table_name]->getTable()->getB2DBAlias() . '.' . $column_name;
            }

            foreach ($this->joins as $join) {
                if ($join->getTable()->getB2DBName() == $table_name) {
                    return $join->getTable()->getB2DBAlias() . '.' . $column_name;
                }
            }

            throw new Exception("Couldn't find table name '{$table_name}' for column '{$column_name}', column was '{$column}'. If this is a column from a foreign table, make sure the foreign table is joined.");
        }
1094258
public function column($column)
    {
        $result = $this->fields($column)->one(); 

        // only return something if something is found
        if (is_array($result))
        {
            return reset($result);
        }
    }
657122
public function count($columns = '*')
    {
        $result = $this->getBuilder()->count($columns);

        // Reset query builder
        $this->resetBuilder();

        return (int) $result;
    }
1026187
public function count($column = NULL)
	{
		if ($column) {
			return $this->sum($column);
		}

		if ($this->result) {
			return count($this->result);
		}

		list(, $criteria, $options) = $this->queryBuilder->buildSelectQuery();

		return $this->query->count($this->name, $criteria, $options);
	}
980339
public function getCountForPagination($columns = ['*'])
    {
        $results = $this->runPaginationCountQuery($columns);

        // Once we have run the pagination count query, we will get the resulting count and
        // take into account what type of query it was. When there is a group by we will
        // just return the count of the entire results set since that will be correct.
        if (isset($this->groups)) {
            return count($results);
        }
        if (!isset($results[0])) {
            return 0;
        }
        if (is_object($results[0])) {
            return (int) $results[0]->aggregate;
        }

        return (int) array_change_key_case((array) $results[0])['aggregate'];
    }
4211
public function count($columns = '*')
    {
        if (! is_array($columns)) {
            $columns = [$columns];
        }

        return (int) $this->aggregate(__FUNCTION__, $columns);
    }
956059
private function _count($method, $column = NULL)
    {
        $this->options['limit']['0'] = 1;
        if($method == 'distinct')
            if(is_null($column)) // 默认id
                $this->options['field']['0'] = 'count(' . $method . ' `' . $this->key . '`) as count';
            else
                $this->options['field']['0'] = 'count(' . $method . ' `' . $column . '`) as count';
        elseif(is_null($column) && $method == 'count') // 默认*
            $this->options['field']['0'] = $method . '(*) as count';
        elseif($column)
            $this->options['field']['0'] = $method . '(`' . $column . '`) as count';
        else // 默认id
            $this->options['field']['0'] = $method . '(`' . $this->key . '`) as count';
        $result = $this->query($this->_parseSql(), $this->prepareParam, false);
        return isset($result->count) ? $result->count : 0;
    }