MergeQuery comments not added to the query sent to the database

Created on 27 December 2012, almost 12 years ago
Updated 18 July 2023, over 1 year ago

The comment() method of the MergeQuery object adds the comments to the query object just fine, but they are never used for anything.

For other types of query objects, the comments are prepended to the query in the __toString() method. Since the MergeQuery doesn't use its (empty) __toString() method, the comments are never prepended.

The attached patch allows the use of comments with MergeQueries, by passing the MergeQuery's comments to all the subqueries generated by the MergeQuery.

🐛 Bug report
Status

Closed: works as designed

Version

9.5

Component
Database 

Last updated 2 days ago

  • Maintained by
  • 🇳🇱Netherlands @daffie
Created by

🇫🇮Finland firebird

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

  • Needs backport to D7

    After being applied to the 8.x branch, it should be considered for backport to the 7.x branch. Note: This tag should generally remain even after the backport has been written, approved, and committed.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10

    There is a comment on the existing __toString method that indicates this was by design?

  • Status changed to Closed: works as designed over 1 year ago
  • 🇳🇱Netherlands Lendude Amsterdam
      /**
       * Implements PHP magic __toString method to convert the query to a string.
       *
       * In the degenerate case, there is no string-able query as this operation
       * is potentially two queries.
       *
       * @return string
       *   The prepared query statement.
       */
      public function __toString() {
      }
    

    Yeah, agreed, this feel like it's by design. Closing for now, feel free to reopen this if you feel this is still something we should address.

    Thanks!

Production build 0.71.5 2024