Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Connection.php

function Connection::makeComment

Flatten an array of query comments into a single comment string.

The comment string will be sanitized to avoid SQL injection attacks.

Parameters

string[] $comments: An array of query comment strings.

Return value

string A sanitized comment string.

File

core/lib/Drupal/Core/Database/Connection.php, line 572

Class

Connection
Base Database API class.

Namespace

Drupal\Core\Database

Code

public function makeComment($comments) {
    if (empty($comments)) {
        return '';
    }
    // Flatten the array of comments.
    $comment = implode('. ', $comments);
    // Sanitize the comment string so as to avoid SQL injection attacks.
    return '/* ' . $this->filterComment($comment) . ' */ ';
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal