src/Mysql/Query/Update.php
public function commit()
    {
        try {
            $toUpdate = array_merge($this->getFieldsToUpdate(), $this->getFieldsToDelete());

            if (! empty($toUpdate)) {
                $idField  = $this->_item->getIdField();

                $query = "
                    UPDATE
                        `" . $this->getDbPrefix() . $this->_item->getDbContainer() . "`
                    SET
                        " . $this->_getPreparedFields($toUpdate) . "
                    WHERE
                        `$idField` = ?";

                if (! array_key_exists($idField, $toUpdate)) {
                    $toUpdate[$idField] = $this->_item->getId()->getOrig();
                }

                $prepared = Agl::app()->getDb()->getConnection()->prepare($query);

                if (! $prepared->execute(array_values($toUpdate))) {
                    $error = $prepared->errorInfo();
                    throw new Exception("The update query failed (table '" . $this->getDbPrefix() . $this->_item->getDbContainer() . "') with message '" . $error[2] . "'");
                }

                if (Agl::app()->isDebugMode()) {
                    Agl::app()->getDb()->incrementCounter();
                }

                return $prepared->rowCount();
            }
        } catch (Exception $e) {
            throw new Exception($e);
        }

        return true;
    }
public function commit()
    {
        try {
            $toUpdate = array_merge($this->getFieldsToUpdate(), $this->getFieldsToDelete());

            if (! empty($toUpdate)) {
                $idField  = $this->_item->getIdField();

                $query = "
                    UPDATE
                        `" . $this->getDbPrefix() . $this->_item->getDbContainer() . "`
                    SET
                        " . $this->_getPreparedFields($toUpdate) . "
                    WHERE
                        `$idField` = ?";

                if (! array_key_exists($idField, $toUpdate)) {
                    $toUpdate[$idField] = $this->_item->getId()->getOrig();
                }

                $prepared = Agl::app()->getDb()->getConnection()->prepare($query);

                if (! $prepared->execute(array_values($toUpdate))) {
                    $error = $prepared->errorInfo();
                    throw new Exception("The update query failed (table '" . $this->getDbPrefix() . $this->_item->getDbContainer() . "') with message '" . $error[2] . "'");
                }

                if (Agl::app()->isDebugMode()) {
                    Agl::app()->getDb()->incrementCounter();
                }

                return $prepared->rowCount();
            }
        } catch (Exception $e) {
            throw new Exception($e);
        }

        return true;
    }
public function commit ( ) { try { $ toUpdate = array_merge ( $ this -> getFieldsToUpdate ( ) , $ this -> getFieldsToDelete ( ) ) ; if ( ! empty ( $ toUpdate ) ) { $ idField = $ this -> _item -> getIdField ( ) ; $ query = "
                    UPDATE
                        `" . $ this -> getDbPrefix ( ) . $ this -> _item -> getDbContainer ( ) . "`
                    SET
                        " . $ this -> _getPreparedFields ( $ toUpdate ) . "
                    WHERE
                        `$idField` = ?" ; if ( ! array_key_exists ( $ idField , $ toUpdate ) ) { $ toUpdate [ $ idField ] = $ this -> _item -> getId ( ) -> getOrig ( ) ; } $ prepared = Agl :: app ( ) -> getDb ( ) -> getConnection ( ) -> prepare ( $ query ) ; if ( ! $ prepared -> execute ( array_values ( $ toUpdate ) ) ) { $ error = $ prepared -> errorInfo ( ) ; throw new Exception ( "The update query failed (table '" . $ this -> getDbPrefix ( ) . $ this -> _item -> getDbContainer ( ) . "') with message '" . $ error [ 2 ] . "'" ) ; } if ( Agl :: app ( ) -> isDebugMode ( ) ) { Agl :: app ( ) -> getDb ( ) -> incrementCounter ( ) ; } return $ prepared -> rowCount ( ) ; } } catch ( Exception $ e ) { throw new Exception ( $ e ) ; } return true ; }
Commit the update to MySQL and check the query result.

@return int Number of affected rows
Commit the update to MySQL and check the query result .