Add an exists query.

@param string|array $fields

@return $this
511057
public function exists($fields)
    {
        $fields = is_array($fields) ? $fields : [$fields];

        foreach ($fields as $field) {
            $query = new ExistsQuery($field);

            $this->append($query);
        }

        return $this;
    }
90594
public function show(array $fields) 
	{
		$this->show = array();
		
		foreach($fields as $field) {
			$this->show[$field] = true;
		}
		
		return $this;
	}
1241368
public function fields($fields)
    {
        if (!is_string($fields)) {
            throw new FatalException('Only strings are allowed in COUNT query');
        }

        $this->fields = sprintf(
            'COUNT(%s)',
            DatabaseConnectionFactory::get()->quoteIdentifier($fields)
        );

        return $this;
    }
155771
public function select($fields)
    {
        foreach ($this->queries as $query) {
            $query->select($fields);
        }

        return $this;
    }
1008721
public function insert(array $fields = []) {
        $query = new InsertQuery($this->getTable());
        $query->fields(!empty($fields)? $fields : $this->getFields());
        return $this->connection->exec($query);
    }
1035597
public function whereNotNull($fields)
    {
        if (!is_array($fields)) {
            $fields = [$fields];
        }

        $exp = $this->newExpr();

        foreach ($fields as $field) {
            $exp->isNotNull($field);
        }

        return $this->where($exp);
    }
460126
public function with(...$fields) {
        foreach ($fields as $f) {
            $this->eagerFields[ $f ] = $f;
        }

        return $this;
    }
175887
protected function setQueryFields(array $fields)
    {
        $this->queryFields = array();
        foreach ($fields as $field => $included) {
            if ($included) $this->queryFields[$field] = 1;
        }
    }
533592
public function selectDistinct($fields)
    {
        if ($this->overwriteEnabled === true) {
            $this->statements['distincts'] = $fields;
        } else {
            $this->addStatement('distincts', $fields);
        }

        return $this;
    }
794939
public function addSelect($fields)
    {
        if (func_num_args() > 1) {
            $fields = func_get_args();
        } elseif (!is_array($fields)) {
            $fields = array($fields);
        }
        foreach ($fields as $idx => $field) {
            $this->selectField($field, is_numeric($idx) ? null : $idx);
        }

        return $this;
    }
482384
public function select($fields)
    {
        if (is_string($fields))
            $fields = explode(',',trim($fields));
        if (is_array($fields))
            $this->fields = $fields;
        return $this;
    }
211985
public function fields(array $fields = [])
    {
        if (!Arr::isAssoc($fields)) {
            $fields = array_combine($fields, $fields);
        }

        foreach ($fields as $field => $label) {
            $this->field($field, $label);
        }

        return $this;
    }
343631
public function GroupBy($fields): QueryBuilder
    {
        if (is_array($fields)) {
            $fields = implode(', ', $field);
        }
        
        $this->group_by = $fields;
        
        return $this;
    }
1246422
public function setFields($fields)
    {
        if ($fields instanceof RecordFields) {
            $this->fields = $fields;
        } else {
            if (is_array($fields)) {
                $fields       = new RecordFields($fields);
                $this->fields = $fields;
            }
        }
        return $this;
    }
1332270
public function update(array $fields = []) {
        $query = new UpdateQuery($this->getTable());
        $query->fields(!empty($fields)? $fields : $this->getFields());
        $query->whereConditionGroup($this->getWhereConditionGroup());
        return $this->connection->exec($query);
    }
553390
public function fields($fields)
    {
        $fields = is_array($fields) && func_num_args() === 1 ? $fields : func_get_args();
        $this->_parts['fields'] = Set::merge($this->_parts['fields'], $fields);
        return $this;
    }
113602
public function fields($fields) {
        if (!is_array($fields)) {
            $fields = func_get_args();
        }

        $this->_fields = $fields;

        return $this;
    }