[DBAL-559] SQL Server Platform error on LOCK MODE in cases of inheritance Created: 17/Jul/13  Updated: 08/Sep/13  Resolved: 08/Sep/13

Status: Resolved
Project: Doctrine DBAL
Component/s: Platforms
Affects Version/s: 2.3.4
Fix Version/s: 2.3.4
Security Level: All

Type: Bug Priority: Critical
Reporter: Fryderyk Benigni Assignee: Benjamin Eberlei
Resolution: Duplicate Votes: 0
Labels: sqlserver

Windows Server, SQL Server 2008

Issue Links:
duplicates DDC-1624 Locking CTI doesnt work on SQL Server Resolved


Whenever an inheritance is implemented the SQL Server Platform add a Lock Mode at the end of the query while for example on SQL Server 2008 it should add a lock on each joined object.

Current implementation of appendLockHint:

 * {@inheritDoc}
public function appendLockHint($fromClause, $lockMode)
    switch ($lockMode) {
        case LockMode::NONE:
            $lockClause = ' WITH (NOLOCK)';
        case LockMode::PESSIMISTIC_READ:
            $lockClause = ' WITH (HOLDLOCK, ROWLOCK)';
        case LockMode::PESSIMISTIC_WRITE:
            $lockClause = ' WITH (UPDLOCK, ROWLOCK)';
            $lockClause = '';

    return $fromClause . $lockClause;

If the lock mode is added on each object the format of the query would be correct.

Comment by Benjamin Eberlei [ 08/Sep/13 ]

This is a known bug, see DDC-1624

Generated at Fri Oct 09 06:43:33 EDT 2015 using JIRA 6.4.10#64025-sha1:5b8b74079161cd76a20ab66dda52747ee6701bd6.