public function execute($sql, $params = [])
    {
        $sqlOutput = $sql;
        if ($this->maxSqlOutputLength !== null) {
            $sqlOutput = StringHelper::truncate($sql, $this->maxSqlOutputLength, '[... hidden]');
        }

        $time = $this->beginCommand("execute SQL: $sqlOutput");
        $this->db->createCommand($sql)->bindValues($params)->execute();
        $this->endCommand($time);
    }
public function execute($sql, $params = [])
    {
        $sqlOutput = $sql;
        if ($this->maxSqlOutputLength !== null) {
            $sqlOutput = StringHelper::truncate($sql, $this->maxSqlOutputLength, '[... hidden]');
        }

        $time = $this->beginCommand("execute SQL: $sqlOutput");
        $this->db->createCommand($sql)->bindValues($params)->execute();
        $this->endCommand($time);
    }
public function execute ( $ sql , $ params = [ ] ) { $ sqlOutput = $ sql ; if ( $ this -> maxSqlOutputLength !== null ) { $ sqlOutput = StringHelper :: truncate ( $ sql , $ this -> maxSqlOutputLength , '[... hidden]' ) ; } $ time = $ this -> beginCommand ( "execute SQL: $sqlOutput" ) ; $ this -> db -> createCommand ( $ sql ) -> bindValues ( $ params ) -> execute ( ) ; $ this -> endCommand ( $ time ) ; }
Executes a SQL statement.
This method executes the specified SQL statement using [[db]].
@param string $sql the SQL statement to be executed
@param array $params input parameters (name => value) for the SQL execution.
See [[Command::execute()]] for more details.
Executes a SQL statement . This method executes the specified SQL statement using [[ db ]] .