Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-2914

[GH-910] [DDC-2310] Fix SQL generation on table lock hint capable platforms

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Security Level: All
    • Labels:
      None

      Description

      This issue is created automatically through a Github pull request on behalf of deeky666:

      Url: https://github.com/doctrine/doctrine2/pull/910

      Message:

      SQL Server and SQL Anywhere use table lock hints for locking. ORM generates wrong SQL when used in conjunction with joins, in a table inheritance scenario or in a subquery. It places the table lock hints after the `JOIN` clauses, which is wrong. The table lock hints have to be placed after each table alias in the `FROM` clause.

      *Example (current)*
      ```sql
      SELECT t0.id FROM users t0 INNER JOIN profiles t1 ON t0.id = t1.user_id WITH (NOLOCK)
      ```

      *Example (expected)*
      ```sql
      SELECT t0.id FROM users t0 WITH (NOLOCK) INNER JOIN profiles t1 ON t0.id = t1.user_id
      ```

      The testsuites fail big time at the moment because of that and I suppose ORM is more or less unusable at the moment for those platforms without this patch.

      I needed to adjust a lot of tests which compared compiled DQL, to make use of the platforms specific lock hint clauses.
      Also I did not add new tests because there are already so many tests, where this fails without this patch that this is not necessary IMO.

        Activity

        Hide
        Doctrine Bot added a comment -

        A related Github Pull-Request [GH-910] was closed:
        https://github.com/doctrine/doctrine2/pull/910

        Show
        Doctrine Bot added a comment - A related Github Pull-Request [GH-910] was closed: https://github.com/doctrine/doctrine2/pull/910

          People

          • Assignee:
            Benjamin Eberlei
            Reporter:
            Doctrine Bot
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated: