Doctrine DBAL
  1. Doctrine DBAL
  2. DBAL-40

Transparent table&column names escaping

    Details

    • Type: Improvement Improvement
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 2.3, 2.4, 2.4.1
    • Fix Version/s: None
    • Component/s: Platforms
    • Labels:
      None

      Description

      Hello, I would like to re-open the discussion about automatic transparent escaping of all table/column names sent from DBAL to database. It was already discussed in http://www.doctrine-project.org/jira/browse/DDC-88 without any satisfactory result.

      Why do I have to quote any reserved word used in table or column name? Why Doctrine doesn't do this automatically for all table and column
      names used in generated SQL queries?

      Before you start to explain how complicated it is and what problems you will be faced with, try to look at excellent DIBI database layer - how it acts in this way - it's behaviour is very cool. Unfortunally at the moment the full documentation is in czech only, but here is a brief automatic google-translation to english - http://dibiphp.com/en/quick-start.

      My suggestion to Doctrine 2 ORM/DBAL solution is:

      1. Developer should never care about any escaping or avoiding any reserved words - it is not his business, the DBAL shoult solve it transparently and safely.

      2. So there should be no need and even no possibility to add any quotation chars in @column or @table annotations as well as in DQL queries. ORM layer has nothing to do with escaping, it is all a business of the DBAL layer. Current possibility for manual escaping the names in mentioned annotations is totally wrong and should be discontinued.

      3. DBAL should escape ALL table and column names transparently and automatically. There should be ne option to enable or disable the escaping, there is no reason for disabling it.

      4. The escaping should be performed just in the final translation of DBAL queries to native SQL query, not earlier. This is the right place to do that.

      So what do you think about that?

        Issue Links

          Activity

          Jan Tichý created issue -
          Benjamin Eberlei made changes -
          Field Original Value New Value
          Link This issue relates to DBAL-96 [ DBAL-96 ]
          Benjamin Eberlei made changes -
          Workflow jira [ 11724 ] jira-feedback2 [ 17561 ]
          Benjamin Eberlei made changes -
          Workflow jira-feedback2 [ 17561 ] jira-feedback3 [ 19915 ]
          Arthur Bodera made changes -
          Affects Version/s 2.4 [ 10320 ]
          Affects Version/s 2.3 [ 10184 ]
          Affects Version/s 2.4.1 [ 10527 ]
          Arthur Bodera made changes -
          Component/s Platforms [ 10056 ]

            People

            • Assignee:
              Benjamin Eberlei
              Reporter:
              Jan Tichý
            • Votes:
              12 Vote for this issue
              Watchers:
              13 Start watching this issue

              Dates

              • Created:
                Updated: