getConnectionTarget example


  public function log(StatementInterface $statement$args$time, float $start = NULL) {
    @trigger_error(__METHOD__ . '() is deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. Use ::logFromEvent(). See https://www.drupal.org/node/3328053', E_USER_DEPRECATED);
    foreach (array_keys($this->queryLog) as $key) {
      $this->queryLog[$key][] = [
        'query' => $statement->getQueryString(),
        'args' => $args,
        'target' => $statement->getConnectionTarget(),
        'caller' => $this->findCaller(),
        'time' => $time,
        'start' => $start,
      ];
    }
  }

  /** * Determine the routine that called this query. * * Traversing the call stack from the very first call made during the * request, we define "the routine that called this query" as the last entry * in the call stack that is not any method called from the namespace of the * database driver, is not inside the Drupal\Core\Database namespace and does * have a file (which excludes call_user_func_array(), anonymous functions * and similar). That makes the climbing logic very simple, and handles the * variable stack depth caused by the query builders. * * See the @link http://php.net/debug_backtrace debug_backtrace() @endlink * function. * * @return array|null * This method returns a stack trace entry similar to that generated by * debug_backtrace(). However, it flattens the trace entry and the trace * entry before it so that we get the function and args of the function that * called into the database system, not the function and args of the * database call itself. * * @deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. Use * Connection::findCallerFromDebugBacktrace(). * * @see https://www.drupal.org/node/3328053 */
Home | Imprint | This part of the site doesn't use cookies.