src/Db/Command.php
public function setSql($sql)
    {
        if ($sql !== $this->_sql) {
            $this->reset();
            $this->_sql = $this->db->quoteSql($sql);
        }

        return $this;
    }
public function setSql($sql)
    {
        if ($sql !== $this->_sql) {
            $this->reset();
            $this->_sql = $this->db->quoteSql($sql);
        }

        return $this;
    }
Specifies the SQL statement to be executed. The SQL statement will be quoted using [[Connection::quoteSql()]].
The previous SQL (if any) will be discarded, and [[params]] will be cleared as well. See [[reset()]]
for details.

@param string $sql the SQL statement to be set.
@return $this this command instance
@see reset()
@see cancel()