@param string   $sql
@param string[] ...$params

@return $this
503000
public function unionAllRaw(string $sql, string ...$params)
    {
        $this->addUnion('ALL', $sql, $params);

        return $this;
    }
786722
public function sql(string $sql, array $params = []) {
        return $this->loadWiths($this->modelManager->sql($sql, $params));
    }
524596
public function whereRaw(string $sql, string ...$params)
    {
        $instance = $this->whereStrategyInstance();

        $instance->whereStrategy()->whereRaw($sql, ...$params);

        return $instance;
    }
368018
public function getRow($sql, $params = array())
    {
        $stmt = $this->execute($sql, $params);
        return $stmt->fetch($this->fetchMode);
    }
835395
public function selectRaw(string $sql, string ...$params)
    {
        $this->addSelect($sql, $params);

        return $this;
    }
264582
public function sqlFetchAllColumn(string $sql, array $params = [], string $column = '0'): array
    {
        return $this->connection()->sqlFetchAllColumn($sql, $params, $column);
    }
799335
public function selectRaw(string $sql, string ...$params)
    {
        $instance = $this->selectQueryInstance();

        $instance->selectQuery()->columnRaw($sql, ...$params);

        return $instance;
    }
1219677
public function addHaving(string $logic, $sql, array $params = [])
    {
        $this->hConditions()->addCondition($logic, $sql, $params);

        return $this;
    }
1131488
public function orHavingRaw(string $sql, string ...$params)
    {
        $this->hConditions()->orRaw($sql, ...$params);

        return $this;
    }
513496
public function exec($sql, array $params=null, array $driverOptions=null) {
		$retval = null;
		$this->sth = null;
		if(!is_null($params)) {
			$retval = $this->run_query($sql, $params, $driverOptions);
		}
		else {
			$retval = $this->dbh->exec($sql);
		}
		
		return($retval);
	}
768276
public function add_from_sql($sql, $params) {
        global $DB;
        $userids = $DB->get_records_sql($sql, $params);
        if (!empty($userids)) {
            $this->userids = array_merge($this->userids, $userids);
        }
    }
1177010
public function query($sql, array $params = array())
    {
        //$helper = $this->getHelper();
        $con = $this->establishConnection();
        $sth = $con->prepare($sql, array(Connection::ATTR_CURSOR => Connection::CURSOR_SCROLL));

        // bind params
        foreach($params as $key => $value){
            $type = Connection::PARAM_STR;
            if ( is_null($value) ) {
                $type = Connection::PARAM_NULL;
            } elseif ( is_int($value) ) {
                $type = Connection::PARAM_INT;
            } elseif ( is_bool($value) ) {
                $type = Connection::PARAM_BOOL;
            } elseif ( is_resource($value) ) {
                $type = Connection::PARAM_LOB;
            }
            if ( is_int($key) ) {
                $sth->bindValue($key + 1, $value, $type);
            } else {
                $sth->bindValue($key, $value, $type);
            }
        }

        $result = $sth->execute();
        return $sth;
    }
863127
public function groupBy($sql, $params=array())
    {
        $binder = new Binder();
        $this->_group = $binder->magicBind($sql, (array) $params);

        return $this;
    }
970842
public function groupByRaw(string $sql, string ...$params)
    {
        $instance = $this->groupByStrategyInstance();

        $instance->groupByStrategy()->groupByRaw($sql, ...$params);

        return $instance;
    }
962578
public function havingRaw(string $sql, string ...$params)
    {
        $instance = $this->havingStrategyInstance();

        $instance->havingStrategy()->havingRaw($sql, ...$params);

        return $instance;
    }
1106311
public function andWhere($sql=null, $params=array())
    {
        if(!isset($this->_where))
            $this->_where = new Criteria();

        $this->_where->and(new Criteria($sql, $params));

        return $this;
    }
1008012
public function addOrderBy(string $sql, ?string $type, array $params = [])
    {
        $this->orderBy[] = [
            'sql'    => $sql,
            'type'   => $type,
            'params' => $params,
        ];

        return $this;
    }