defaultOptions example


  public function query($query, array $args = []$options = []) {
    assert(is_string($query), 'The \'$query\' argument to ' . __METHOD__ . '() must be a string');

    // Use default values if not already set.     $options += $this->defaultOptions();

    if (isset($options['return'])) {
      @trigger_error('Passing "return" option to ' . __METHOD__ . '() is deprecated in drupal:9.4.0 and is removed in drupal:11.0.0. For data manipulation operations, use dynamic queries instead. See https://www.drupal.org/node/3185520', E_USER_DEPRECATED);
    }

    assert(!isset($options['target']), 'Passing "target" option to query() has no effect. See https://www.drupal.org/node/2993033');

    $this->expandArguments($query$args);
    $stmt = $this->prepareStatement($query$options);

    try {
      

      throw $e;
    }

    return $pdo;
  }

  /** * {@inheritdoc} */
  public function query($query, array $args = []$options = []) {
    $options += $this->defaultOptions();

    // The PDO PostgreSQL driver has a bug which doesn't type cast booleans     // correctly when parameters are bound using associative arrays.     // @see http://bugs.php.net/bug.php?id=48383     foreach ($args as &$value) {
      if (is_bool($value)) {
        $value = (int) $value;
      }
    }

    // We need to wrap queries with a savepoint if:
Home | Imprint | This part of the site doesn't use cookies.