Adds sql statement into where statement
@param       $sql
@param array $values
@return $this
335961
public function sql($sql, array $values = array())
    {
        $this->whereSqlConditions[] = $sql;
        $this->arguments = array_merge($this->arguments, $values);
        return $this;
    }
1016182
public function query($sql) {
        $result = $this->executeRaw($sql);
        if (!is_resource($result))
            $result = null;
        return new MySQLResult($this, $sql, $result, $this->lastInsertId(), $this->lastAffectedRows());
    }
394322
public function query($sql, $bindings = array())
    {
        list($this->pdoStatement) = $this->statement($sql, $bindings);

        return $this;
    }
1364737
function sql($sql = null, $params = NULL) {
        $params = $this->autoarr($params);
        $sql = str_replace('table.',$this->alias.'.',$sql);
        return $this->execute($sql, $params);
        return $this;
    }
773588
public function queryAndFetchOne($sql, &$values=array())
	{
		$sth = $this->query($sql, $values);
		$row = $sth->fetch(PDO::FETCH_NUM);
		return $row[0];
	}
396812
public function query(string $sql, array $values = []): int
    {
        return $this->dbConnection->prepare($sql)
                ->execute($values)
                ->count();
    }
1270445
public function orderColumns(array $columns, $sql, $bindings = [])
    {
        foreach ($columns as $column) {
            $this->orderColumn($column, str_replace(':column', $column, $sql), $bindings);
        }

        return $this;
    }
699244
public function query(string $sql, $bind = []): Statement
    {
        $this->operation = 'query';
        $this->params = $bind;
        $this->sql = $sql;
        return $this;
    }
591968
public function orWhereRaw(string $sql, string ...$params)
    {
        $this->wConditions()->orRaw($sql, ...$params);

        return $this;
    }
1335051
public function whereIn($column, array $values)
    {
        return $this->where(function ($query) use ($column, $values) {
            $query->whereIn($column, $values);
        });
    }
1178953
private function insert($columns, $values)
    {
        return Query::table(static::$table)
        ->column($columns)
        ->value($values)
        ->insert();
    }
359641
public function andWhereIn($column, array $values)
    {
        $this->where[] = [self::AND_WHERE_IN, $column, $values];

        return $this;
    }
1238420
public function query($sql, array $values = [])
    {
        $result = pg_query_params($this->handler, $sql, $values);

        if ($result === false) {
            throw new \Exception(pg_last_error($this->handler));
        }

        return $result;
    }
791470
private static function preg_replace_query($sql, $values)
	{
		return preg_replace_callback('~{(\w+)(?::(.*))?}~U', function ($matches) use ($values) { return isset($values[$matches[1]]) ? $values[$matches[1]] : (isset($matches[2]) ? $matches[2] : null); }, $sql);
	}
1014560
private function executeSqlQuery($sql)
    {
        try {
            $result = (bool) Database::statement($sql);
        } catch (\Exception $exception) {
            echo "\n\033[0;31m▶\033[00m $sql\n";
            throw $exception;
        }

        echo "\033[0;32m▶\033[00m $sql\n";

        return $this;
    }
134366
public function setSQL($sql, array $args=[]) {
		$this->sql = $sql;
		$this->args = $args;

		$this->message = $this->getMessage();

		if(strlen($sql) > 2048)
			return $this;
		$msg = '<br/>'."\n".'SQL: '.$sql;
		if(count($args) > 0) {
			$msg .= ' ('.implode(', ', $args).')';
			if(strlen($msg) > 2048)
				return $this;
		}
		$this->message .= $msg;

		return $this;
	}
501740
public static function updateBySql($sql)
    {
        if (is_array($sql)) {
            $bind = $sql;
            unset($bind[0]);
            $sql = $sql[0];
        } else {
            $bind = [];
        }

        $model = new static;

        $table = $model->getSource($bind);
        return $model->getConnection($bind)->updateBySql('UPDATE' . " [$table] SET " . $sql, $bind);
    }