Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

Zend\Db\Sql\Update building update statement #6834

Closed
biophymie opened this issue Nov 3, 2014 · 1 comment
Closed

Zend\Db\Sql\Update building update statement #6834

biophymie opened this issue Nov 3, 2014 · 1 comment
Assignees
Milestone

Comments

@biophymie
Copy link

Creating a update-statement returns a incorrect sql statement. If one of the updated column values has a empty value the iteration over the columns breaks, because the Zend/Stdlib/PriorityList stopps if a element is empty.

Method prepareStatement():

 foreach ($this->set as $column => $value) {
            if ($value instanceof Expression) {
                $exprData = $this->processExpression($value, $platform, $driver);
                $setSql[] = $platform->quoteIdentifier($column) . ' = ' . $exprData->getSql();
                $parameterContainer->merge($exprData->getParameterContainer());
            } else {
                $setSql[] = $platform->quoteIdentifier($column) . ' = ' . $driver->formatParameterName($column);
                $parameterContainer->offsetSet($column, $value);
            }
        }

Workaround:

 foreach ($this->set->toArray() as $column => $value) {
            if ($value instanceof Expression) {
                $exprData = $this->processExpression($value, $platform, $driver);
                $setSql[] = $platform->quoteIdentifier($column) . ' = ' . $exprData->getSql();
                $parameterContainer->merge($exprData->getParameterContainer());
            } else {
                $setSql[] = $platform->quoteIdentifier($column) . ' = ' . $driver->formatParameterName($column);
                $parameterContainer->offsetSet($column, $value);
            }
        }
@samsonasik
Copy link
Contributor

it seems duplicate with #6768 like #6820 did, should be fixed by PR #6773

@Ocramius Ocramius added this to the 2.3.4 milestone Nov 20, 2014
@Ocramius Ocramius self-assigned this Nov 20, 2014
Ocramius added a commit that referenced this issue Nov 20, 2014
…'develop'

Close #6773
Close #6768
Close #6820
Close #6834
Close #6881
Forward port #6773
Forward port #6768
Ocramius added a commit that referenced this issue Nov 20, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants