[DDC-2310] Recent changes to DBAL SQL Server platform lock hinting breaks ORM SqlWalker in DQL queries with joins Created: 21/Feb/13 Updated: 21/Feb/13 Resolved: 21/Feb/13
|Project:||Doctrine 2 - ORM|
|Affects Version/s:||Git Master|
|Reporter:||William Schaller||Assignee:||Benjamin Eberlei|
|Labels:||dbal, lockhints, orm, sqlserver, sqlsrv|
The SQL Server platform throws an error when you try to run DQL with JOIN statements.
The breaking change was in the DBAL SQL Server platform – it was changed to add a ' WITH (NOLOCK)' to the appendLockHint function. Change was in this rev. The change in DBAL is not wrong, it just highlighted the bug in the ORM...
The ORM SqlWalker runs the appendLockHint function against a generated FROM / JOIN clause in the walkFromClause func here. This is actually the wrong place to append lock hints. This is generating the FROM clause like:
When it should actually generate something like:
It should append lock hints after the table alias.
I think the only reason this hasn't shown up before is that the other lock hint types haven't been applied in this way before, if at all.
|Comment by Christophe Coevoet [ 21/Feb/13 ]|
I think the line appending the lock should be moved to this place to achieve the result displayed above.
But it may cause issues with some other vendor.
|Comment by William Schaller [ 21/Feb/13 ]|
@Christophe I considered that too. None of the other platforms implement the appendLockHint function. None of the other platforms implement this because it is handled differently on other platforms – with transaction isolation levels and such.