Sets the having clause to the provided sql, optionally binding
parameters into the string.
@chainable
766365
public function having($sql=null, $params=array())
    {
        $this->_having = new Criteria($sql, $params);

        return $this;
    }
1059580
private void setProperties(final JSONObject jsonObject, final List<Object> paramlist, final StringBuilder sql) {
        final Iterator<String> keys = jsonObject.keys();

        final StringBuilder insertString = new StringBuilder();
        final StringBuilder wildcardString = new StringBuilder();

        boolean isFirst = true;
        String key;
        Object value;

        while (keys.hasNext()) {
            key = keys.next();

            if (isFirst) {
                insertString.append("(").append(key);
                wildcardString.append("(?");
                isFirst = false;
            } else {
                insertString.append(",").append(key);
                wildcardString.append(",?");
            }

            value = jsonObject.get(key);
            paramlist.add(value);

            if (!keys.hasNext()) {
                insertString.append(")");
                wildcardString.append(")");
            }
        }

        sql.append("insert into ").append(getName()).append(insertString).append(" values ").append(wildcardString);
    }
592891
public function having() {
        $args = func_get_args();
        $this->build()->bindExpression('having', $args[0] . $args[1] . ' ? ');
        $this->build()->bindParams('having', $args[2]);

        return $this->connection;
    }
895491
def _setop(self, query):
        
        if isinstance(query.select, list):
            # RETURN BORING RESULT SET
            selects = FlatList()
            for s in listwrap(query.select):
                if isinstance(s.value, Mapping):
                    for k, v in s.value.items:
                        selects.append(sql_alias(v, quote_column(s.name + "." + k)))
                if isinstance(s.value, list):
                    for i, ss in enumerate(s.value):
                        selects.append(sql_alias(s.value, quote_column(s.name + "," + str(i))))
                else:
                    selects.append(sql_alias(s.value, quote_column(s.name)))

            sql = expand_template("""
                SELECT
                    {{selects}}
                FROM
                    {{table}}
                {{where}}
                {{sort}}
                {{limit}}
            """, {
                "selects": SQL(",\n".join(selects)),
                "table": self._subquery(query["from"])[0],
                "where": self._where2sql(query.where),
                "limit": self._limit2sql(query.limit),
                "sort": self._sort2sql(query.sort)
            })

            def post_process(sql):
                result = self.db.query(sql)
                for s in listwrap(query.select):
                    if isinstance(s.value, Mapping):
                        for r in result:
                            r[s.name] = {}
                            for k, v in s.value:
                                r[s.name][k] = r[s.name + "." + k]
                                r[s.name + "." + k] = None

                    if isinstance(s.value, list):
                        # REWRITE AS TUPLE
                        for r in result:
                            r[s.name] = tuple(r[s.name + "," + str(i)] for i, ss in enumerate(s.value))
                            for i, ss in enumerate(s.value):
                                r[s.name + "," + str(i)] = None

                expand_json(result)
                return result

            return sql, post_process  # RETURN BORING RESULT SET
        else:
            # RETURN LIST OF VALUES
            if query.select.value == ".":
                select = "*"
            else:
                name = query.select.name
                select = sql_alias(query.select.value, quote_column(name))

            sql = expand_template("""
                SELECT
                    {{selects}}
                FROM
                    {{table}}
                {{where}}
                {{sort}}
                {{limit}}
            """, {
                "selects": SQL(select),
                "table": self._subquery(query["from"])[0],
                "where": self._where2sql(query.where),
                "limit": self._limit2sql(query.limit),
                "sort": self._sort2sql(query.sort)
            })

            if query.select.value == ".":
                def post(sql):
                    result = self.db.query(sql)
                    expand_json(result)
                    return result

                return sql, post
            else:
                return sql, lambda sql: [r[name] for r in self.db.query(sql)]
789283
public function buildHaving()
	{
		$havings = [];

		foreach ($this->having as $having)
		{
			$havings[] = $having['column'] . ' ' . $having['operator'] . ' ?';

			$this->bind(is_string($having['value']) ? trim($having['value']) : $having['value']);
		}

		return 'HAVING ' . implode(" AND ", $havings);
	}
1174327
function set_sql($fields, $from, $where, array $params = array()) {
        $this->sql = new stdClass();
        $this->sql->fields = $fields;
        $this->sql->from = $from;
        $this->sql->where = $where;
        $this->sql->params = $params;
    }
739781
public function having($key, $value = true, $operator = '=')
    {
        $this->getQuery()->having($key, $value, $operator);

        return $this;
    }
588565
@NotNull
    public DbPreparedStatement<T> set(@NotNull String name, boolean value) throws SQLException {
        for (int i : getIndexes(name)) {
            statement.setBoolean(i, value);
        }
        return this;
    }
1136152
public int setParameter(final PreparedStatement preparedStatement, final int index,
			final BindParameterMapperManager parameterMapperManager) throws SQLException {
		return setInParameter(preparedStatement, index, parameterMapperManager);
	}
1301304
public function havingRaw($sql, array $bindings = array(), $boolean = 'and')
	{
		$type = 'raw';

		$this->havings[] = compact('type', 'sql', 'boolean');

		$this->bindings = array_merge($this->bindings, $bindings);

		return $this;
	}
1034242
protected void appendHavingClause(StringBuffer having, Criteria crit, StringBuffer stmt)
    {
        if (having.length() == 0)
        {
            having = null;
        }

        if (having != null || crit != null)
        {
            stmt.append(" HAVING ");
            appendClause(having, crit, stmt);
        }
    }
645393
protected function prepareSelect($select, $from, $where='', $group='', $having='', $order='', $limit=''){     
        $sql= "SELECT " . $select;
        $sql.= " FROM " . $from;
        if($where != '' && $where != NULL){$sql.= " WHERE " . $where;}        
        $sql.= $group;
        if($having != '' && $having != NULL){$sql.= " HAVING " . $having;}
        $sql.= $order;
        $sql.= $limit;
        //Preparo la consulta y la retorno
        return $this->connection->prepare($sql);
    }
1261272
public function having($column, $operator, $value = null)
    {
        $this->hConditions()->column(...func_get_args());

        return $this;
    }
1140412
private function generateSQL(&$sql, $from, $joins, $where, $having, $group, $values) {
        $froms = [];
        foreach ($from as $f) {
            $froms [] = $f [0] . ' AS ' . $f [1];
        }
        $sql [] = implode(',', $froms);
        if ($joins) {
            foreach ($joins as $join) {
                $sql [] = $join [2] . ' ' . $join [0] . ' AS ' . $join [3] . ' ON (' . $join [1] . ')';
            }
        }
        if ($where && count($where) > 0) {
            $sql [] = 'WHERE ' . $where->getWhereCondition($this, $values);
        }
        if ($group) {
            $sql [] = 'GROUP BY ' . implode(' , ', $group);
        }
        if ($having) {
            $sql [] = 'HAVING ' . implode(' AND ', $having);
        }
    }
383909
public OqlBuilder<T> having(final String what) {
    Assert.isTrue(null != groups && !groups.isEmpty());
    if (Strings.isNotEmpty(what)) having = what;
    return this;
  }
728279
protected function buildHaving()
    {
        if (count($this->having) === 0) {
            return '';
        }

        // Use a ConditionSet to build the having clause
        $conditionSet = new Query\Condition\AndSet($this, $this->having);
        return "HAVING {$conditionSet->buildWithoutParentheses()}";
    }
1321555
public function andHaving($having)
    {
        $args   = func_get_args();
        $having = $this->getDQLPart('having');

        if ($having instanceof Expr\Andx) {
            $having->addMultiple($args);
        } else {
            array_unshift($args, $having);
            $having = new Expr\Andx($args);
        }

        return $this->add('having', $having);
    }