Doctrine DBAL
  1. Doctrine DBAL
  2. DBAL-552

Colon (":") in field name treats like query parameter

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.3.5, 2.5, 2.4.2
    • Component/s: None
    • Security Level: All
    • Labels:
      None
    • Environment:
      MySQL

      Description

      The colon sign (":") is permitted for columns' name but Doctrine treats them like parameters placeholder:

      SELECT `d.ns:col_name` FROM my_table d WHERE `d.date` >= :param1
      

      causes DBALException:

      An exception occurred while executing 'SELECT `d.ns:col_name` FROM my_table d WHERE `d.date` >= :param1' with params ["2013-06-24 14:22:18"]: Value for :col_name not found in params array. Params array key should be "col_name"
      

        Issue Links

          Activity

          Hide
          Benjamin Eberlei added a comment -

          does this work with plain PDO?

          Show
          Benjamin Eberlei added a comment - does this work with plain PDO?
          Hide
          Daniel Bojdo added a comment - - edited

          Yes, it works perfectly fine with PDO. It also works properly with Doctrine\DBAL\Connection.
          I suppose there's a bug somewhere in QueryBuilder.

          Show
          Daniel Bojdo added a comment - - edited Yes, it works perfectly fine with PDO. It also works properly with Doctrine\DBAL\Connection. I suppose there's a bug somewhere in QueryBuilder.
          Hide
          Steve Müller added a comment -
          Show
          Steve Müller added a comment - Patch supplied in PR: https://github.com/doctrine/dbal/pull/477
          Hide
          Doctrine Bot added a comment -

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

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

            People

            • Assignee:
              Steve Müller
              Reporter:
              Daniel Bojdo
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: