Doctrine DBAL
  1. Doctrine DBAL
  2. DBAL-88

MySqlPlatform not escaping table names

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0
    • Fix Version/s: 2.0.2, 2.1
    • Component/s: Platforms
    • Labels:
      None

      Description

      Methods in the MySql Platform that use the table name are not escaping the table name. This causes problems when your table name is the same as a reserved word in MySql. Example:

      public function getListTableConstraintsSQL($table)

      { return 'SHOW INDEX FROM ' . $table; }

      If my table name is User this method will fail and cause a SQL error because the word User is a reserved word in MySql. You need to escape the table name with backticks to prevent these errors. Example:

      public function getListTableConstraintsSQL($table)

      { return 'SHOW INDEX FROM `' . $table . '`'; }

      I encountered this problem while reverse engineering my existing MySql database. I've attached a fixed version that solved my reverse engineering problems.

        Issue Links

          Activity

          James Reed created issue -
          Hide
          Benjamin Eberlei added a comment -

          Duplicate of DDC-976

          Show
          Benjamin Eberlei added a comment - Duplicate of DDC-976
          Benjamin Eberlei made changes -
          Field Original Value New Value
          Status Open [ 1 ] Resolved [ 5 ]
          Resolution Duplicate [ 3 ]
          Benjamin Eberlei made changes -
          Link This issue duplicates DDC-976 [ DDC-976 ]
          Hide
          Benjamin Eberlei added a comment -

          This issue is not a duplicate, only related to DBAL-91.

          Show
          Benjamin Eberlei added a comment - This issue is not a duplicate, only related to DBAL-91 .
          Benjamin Eberlei made changes -
          Resolution Duplicate [ 3 ]
          Status Resolved [ 5 ] Reopened [ 4 ]
          Hide
          Benjamin Eberlei added a comment -

          Fixed

          Show
          Benjamin Eberlei added a comment - Fixed
          Benjamin Eberlei made changes -
          Status Reopened [ 4 ] Resolved [ 5 ]
          Fix Version/s 2.0.2 [ 10118 ]
          Fix Version/s 2.1 [ 10068 ]
          Resolution Fixed [ 1 ]
          Benjamin Eberlei made changes -
          Workflow jira [ 12373 ] jira-feedback2 [ 17695 ]
          Benjamin Eberlei made changes -
          Workflow jira-feedback2 [ 17695 ] jira-feedback3 [ 20050 ]

          This list may be incomplete, as errors occurred whilst retrieving source from linked applications:

          • Request to http://www.doctrine-project.org/fisheye/ failed: Error in remote call to 'FishEye 0 (http://www.doctrine-project.org/fisheye/)' (http://www.doctrine-project.org/fisheye) [AbstractRestCommand{path='/rest-service-fe/search-v1/crossRepositoryQuery', params={query=DBAL-88, expand=changesets[0:20].revisions[0:29],reviews}, methodType=GET}] : Received status code 503 (Service Temporarily Unavailable)

            People

            • Assignee:
              Benjamin Eberlei
              Reporter:
              James Reed
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: