DeleteQuery and UpdateQuery execute return value

Created on 12 November 2012, over 12 years ago
Updated 1 August 2025, 2 days ago

API page: http://api.drupal.org/api/drupal/includes%21database%21query.inc/functio...

Enter a descriptive title (above) relating to DeleteQuery::__construct, then describe the problem you have found:

Sometimes it's useful to get the rows returned by an insert, an update or delete query. Rules system in PostgreSQL allows to return rows from those queries. The code enforces the RETURN_AFFECTED option. Consider to turn this feature optional like in the InsertQuery object.

  /**
   * Constructs an UpdateQuery object.
   *
   * @param DatabaseConnection $connection
   *   A DatabaseConnection object.
   * @param string $table
   *   Name of the table to associate with this query.
   * @param array $options
   *   Array of database options.
   */
  public function __construct(DatabaseConnection $connection, $table, array $options = array()) {
    if (!isset($options['return'])) { // Set this option only if the caller didn't it.
      $options['return'] = Database::RETURN_AFFECTED;
    }
    parent::__construct($connection, $options);
    $this->table = $table;

    $this->condition = new DatabaseCondition('AND');
  }

Regards.

✨ Feature request
Status

Postponed: needs info

Version

11.0 πŸ”₯

Component

postgresql db driver

Created by

πŸ‡¦πŸ‡·Argentina abel_osorio

Live updates comments and jobs are added and updated live.
  • PostgreSQL

    Particularly affects sites running on the PostgreSQL database.

  • 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.

  • stale-issue-cleanup

    To track issues in the developing policy for closing stale issues, [Policy, no patch] closing older issues

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.

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Thank you for sharing your idea for improving Drupal.

    We are working to decide if this proposal meets the Criteria for evaluating proposed changes. There hasn't been any discussion here for over 8 years which suggests that this has either been implemented or there is no community support. Your thoughts on this will allow a decision to be made.

    Since we need more information to move forward with this issue, the status is now Postponed (maintainer needs more info). If we don't receive additional information to help with the issue, it may be closed after three months.

    Thanks!

Production build 0.71.5 2024