You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.
For technical background please refer to #7311. I've verified the fix and it was correct for Insert, however, for Update and Delete - the behaviour is still buggy.
As @weierophinney investigated in #7311 Zend\Db\Sql\Sql::prepareStatementForSqlObject() should get unaliased table name from Zend\Db\TableGateway\AbstractTableGateway::executeUpdate()/executeDelete().
Technically, there are two approaches to the problem. While no flavour of SQL allows aliases for insert (at least AFAIK), some platforms do allow aliases in update and delete. It has a different syntax, but it works.
Example for SQL Server: DELETE U FROM Users AS U WHERE id = 1
or UPDATE U SET U.Name = 'Any' FROM Users U WHERE U.ID = 1
So, first and easy approach is to pass unaliased table (as done in Insert). Second is to use alternative syntax but it's not platfiorm agnostic (and I believe ZF2 maintains compatibility in DBAL).
The text was updated successfully, but these errors were encountered:
This issue has been moved from the
zendframework
repository as part of the bug migration program as outlined here - http://framework.zend.com/blog/2016-04-11-issue-closures.htmlOriginal Issue: https://api.github.com/repos/zendframework/zendframework/issues/7430
User: @mirfilip
Created On: 2015-04-07T13:57:06Z
Updated At: 2015-11-06T21:16:13Z
Body
This is a continuation of #7311, I should have been more precise with previous bug description for
Insert
.For technical background please refer to #7311. I've verified the fix and it was correct for
Insert
, however, forUpdate
andDelete
- the behaviour is still buggy.As @weierophinney investigated in #7311
Zend\Db\Sql\Sql::prepareStatementForSqlObject()
should get unaliased table name fromZend\Db\TableGateway\AbstractTableGateway::executeUpdate()/executeDelete()
.Technically, there are two approaches to the problem. While no flavour of SQL allows aliases for
insert
(at least AFAIK), some platforms do allow aliases inupdate
anddelete
. It has a different syntax, but it works.Example for SQL Server:
DELETE U FROM Users AS U WHERE id = 1
or
UPDATE U SET U.Name = 'Any' FROM Users U WHERE U.ID = 1
So, first and easy approach is to pass unaliased table (as done in
Insert
). Second is to use alternative syntax but it's not platfiorm agnostic (and I believe ZF2 maintains compatibility in DBAL).The text was updated successfully, but these errors were encountered: