public function write($query, array $bindings=[], $returnAffected=null)
    {
        $returnAffected = $returnAffected !== null
                          ? $returnAffected
                          : $this->getOption(static::RETURN_LAST_AFFECTED);

        $this->callBeforeListeners('write',[$query, $bindings]);

        if (!$bindings) {
            $rows = $this->writeUnprepared($query);
            $this->callAfterListeners('write',[$query, $bindings]);
            return $returnAffected ? $rows : null;
        }

        $statement = $this->runPrepared($query, $bindings);

        $this->callAfterListeners('write',[$query, $bindings]);

        return $returnAffected ? $statement->rowCount() : null;
    }
public function write($query, array $bindings=[], $returnAffected=null)
    {
        $returnAffected = $returnAffected !== null
                          ? $returnAffected
                          : $this->getOption(static::RETURN_LAST_AFFECTED);

        $this->callBeforeListeners('write',[$query, $bindings]);

        if (!$bindings) {
            $rows = $this->writeUnprepared($query);
            $this->callAfterListeners('write',[$query, $bindings]);
            return $returnAffected ? $rows : null;
        }

        $statement = $this->runPrepared($query, $bindings);

        $this->callAfterListeners('write',[$query, $bindings]);

        return $returnAffected ? $statement->rowCount() : null;
    }
public function write ( $ query , array $ bindings = [ ] , $ returnAffected = null ) { $ returnAffected = $ returnAffected !== null ? $ returnAffected : $ this -> getOption ( static :: RETURN_LAST_AFFECTED ) ; $ this -> callBeforeListeners ( 'write' , [ $ query , $ bindings ] ) ; if ( ! $ bindings ) { $ rows = $ this -> writeUnprepared ( $ query ) ; $ this -> callAfterListeners ( 'write' , [ $ query , $ bindings ] ) ; return $ returnAffected ? $ rows : null ; } $ statement = $ this -> runPrepared ( $ query , $ bindings ) ; $ this -> callAfterListeners ( 'write' , [ $ query , $ bindings ] ) ; return $ returnAffected ? $ statement -> rowCount ( ) : null ; }
Run an altering statement.

@param string|\Ems\Contracts\Stringable $query
@param array                            $bindings (optional)
@param bool                             $returnAffected (optional)

@return int (Number of affected rows)
Run an altering statement .