function Sql::placeholder

Same name in other branches
  1. 9 core/modules/views/src/Plugin/views/query/Sql.php \Drupal\views\Plugin\views\query\Sql::placeholder()
  2. 8.9.x core/modules/views/src/Plugin/views/query/Sql.php \Drupal\views\Plugin\views\query\Sql::placeholder()
  3. 11.x core/modules/views/src/Plugin/views/query/Sql.php \Drupal\views\Plugin\views\query\Sql::placeholder()

Generates a unique placeholder used in the db query.

File

core/modules/views/src/Plugin/views/query/Sql.php, line 1112

Class

Sql
Views query plugin for an SQL query.

Namespace

Drupal\views\Plugin\views\query

Code

public function placeholder($base = 'views') {
    static $placeholders = [];
    if (!isset($placeholders[$base])) {
        $placeholders[$base] = 0;
        return ':' . $base;
    }
    else {
        return ':' . $base . ++$placeholders[$base];
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.