kernel/classes/ezpersistentobject.php
public static function updateObjectList( $parameters )
    {
        $db = eZDB::instance();
        $def = $parameters['definition'];
        $table = $def['name'];
        $fields = $def['fields'];
        $keys = $def['keys'];

        $updateFields = $parameters['update_fields'];
        $conditions = $parameters['conditions'];

        $query = "UPDATE $table SET ";
        $i = 0;
        $valueBound = false;

        foreach( $updateFields as $field => $value )
        {
            $fieldDef = $fields[ $field ];
            $numericDataTypes = array( 'integer', 'float', 'double' );
            if ( strlen( $value ) == 0 &&
                 is_array( $fieldDef ) &&
                 in_array( $fieldDef['datatype'], $numericDataTypes  ) &&
                 array_key_exists( 'default', $fieldDef ) &&
                 $fieldDef[ 'default' ] !== null )
            {
                $value = $fieldDef[ 'default' ];
            }

            $bindDataTypes = array( 'text' );
            if ( $db->bindingType() != eZDBInterface::BINDING_NO &&
                 $db->countStringSize( $value ) > 2000 &&
                 is_array( $fieldDef ) &&
                 in_array( $fieldDef['datatype'], $bindDataTypes  )
                 )
            {
                $value = $db->bindVariable( $value, $fieldDef );
                $valueBound = true;
            }
            else
                $valueBound = false;

            if ( $i > 0 )
                $query .= ', ';
            if ( $valueBound )
                $query .= $field . "=" . $value;
            else
                $query .= $field . "='" . $db->escapeString( $value ) . "'";
            ++$i;
        }
        $query .= ' WHERE ';
        $i = 0;
        foreach( $conditions as $conditionKey => $condition )
        {
            if ( $i > 0 )
                $query .= ' AND ';
            if ( is_array( $condition ) )
            {
                $query .= $conditionKey . ' IN (';
                $j = 0;
                foreach( $condition as $conditionValue )
                {
                    if ( $j > 0 )
                        $query .= ', ';
                    $query .= "'" . $db->escapeString( $conditionValue ) . "'";
                    ++$j;
                }
                $query .= ')';
            }
            else
                $query .= $conditionKey . "='" . $db->escapeString( $condition ) . "'";
            ++$i;
        }
        $db->query( $query );
    }
public static function updateObjectList( $parameters )
    {
        $db = eZDB::instance();
        $def = $parameters['definition'];
        $table = $def['name'];
        $fields = $def['fields'];
        $keys = $def['keys'];

        $updateFields = $parameters['update_fields'];
        $conditions = $parameters['conditions'];

        $query = "UPDATE $table SET ";
        $i = 0;
        $valueBound = false;

        foreach( $updateFields as $field => $value )
        {
            $fieldDef = $fields[ $field ];
            $numericDataTypes = array( 'integer', 'float', 'double' );
            if ( strlen( $value ) == 0 &&
                 is_array( $fieldDef ) &&
                 in_array( $fieldDef['datatype'], $numericDataTypes  ) &&
                 array_key_exists( 'default', $fieldDef ) &&
                 $fieldDef[ 'default' ] !== null )
            {
                $value = $fieldDef[ 'default' ];
            }

            $bindDataTypes = array( 'text' );
            if ( $db->bindingType() != eZDBInterface::BINDING_NO &&
                 $db->countStringSize( $value ) > 2000 &&
                 is_array( $fieldDef ) &&
                 in_array( $fieldDef['datatype'], $bindDataTypes  )
                 )
            {
                $value = $db->bindVariable( $value, $fieldDef );
                $valueBound = true;
            }
            else
                $valueBound = false;

            if ( $i > 0 )
                $query .= ', ';
            if ( $valueBound )
                $query .= $field . "=" . $value;
            else
                $query .= $field . "='" . $db->escapeString( $value ) . "'";
            ++$i;
        }
        $query .= ' WHERE ';
        $i = 0;
        foreach( $conditions as $conditionKey => $condition )
        {
            if ( $i > 0 )
                $query .= ' AND ';
            if ( is_array( $condition ) )
            {
                $query .= $conditionKey . ' IN (';
                $j = 0;
                foreach( $condition as $conditionValue )
                {
                    if ( $j > 0 )
                        $query .= ', ';
                    $query .= "'" . $db->escapeString( $conditionValue ) . "'";
                    ++$j;
                }
                $query .= ')';
            }
            else
                $query .= $conditionKey . "='" . $db->escapeString( $condition ) . "'";
            ++$i;
        }
        $db->query( $query );
    }
public static function updateObjectList ( $ parameters ) { $ db = eZDB :: instance ( ) ; $ def = $ parameters [ 'definition' ] ; $ table = $ def [ 'name' ] ; $ fields = $ def [ 'fields' ] ; $ keys = $ def [ 'keys' ] ; $ updateFields = $ parameters [ 'update_fields' ] ; $ conditions = $ parameters [ 'conditions' ] ; $ query = "UPDATE $table SET " ; $ i = 0 ; $ valueBound = false ; foreach ( $ updateFields as $ field => $ value ) { $ fieldDef = $ fields [ $ field ] ; $ numericDataTypes = array ( 'integer' , 'float' , 'double' ) ; if ( strlen ( $ value ) == 0 && is_array ( $ fieldDef ) && in_array ( $ fieldDef [ 'datatype' ] , $ numericDataTypes ) && array_key_exists ( 'default' , $ fieldDef ) && $ fieldDef [ 'default' ] !== null ) { $ value = $ fieldDef [ 'default' ] ; } $ bindDataTypes = array ( 'text' ) ; if ( $ db -> bindingType ( ) != eZDBInterface :: BINDING_NO && $ db -> countStringSize ( $ value ) > 2000 && is_array ( $ fieldDef ) && in_array ( $ fieldDef [ 'datatype' ] , $ bindDataTypes ) ) { $ value = $ db -> bindVariable ( $ value , $ fieldDef ) ; $ valueBound = true ; } else $ valueBound = false ; if ( $ i > 0 ) $ query .= ', ' ; if ( $ valueBound ) $ query .= $ field . "=" . $ value ; else $ query .= $ field . "='" . $ db -> escapeString ( $ value ) . "'" ; ++ $ i ; } $ query .= ' WHERE ' ; $ i = 0 ; foreach ( $ conditions as $ conditionKey => $ condition ) { if ( $ i > 0 ) $ query .= ' AND ' ; if ( is_array ( $ condition ) ) { $ query .= $ conditionKey . ' IN (' ; $ j = 0 ; foreach ( $ condition as $ conditionValue ) { if ( $ j > 0 ) $ query .= ', ' ; $ query .= "'" . $ db -> escapeString ( $ conditionValue ) . "'" ; ++ $ j ; } $ query .= ')' ; } else $ query .= $ conditionKey . "='" . $ db -> escapeString ( $ condition ) . "'" ; ++ $ i ; } $ db -> query ( $ query ) ; }
Updates rows matching the given parameters

Note: Transaction unsafe. If you call several transaction unsafe methods
you must enclose the calls within a db transaction; thus within db->begin
and db->commit.

@param array $parameters
@return void
Updates rows matching the given parameters