function Schema::buildTableNameCondition

Same name in this branch
  1. 11.x core/lib/Drupal/Core/Database/Schema.php \Drupal\Core\Database\Schema::buildTableNameCondition()
Same name and namespace in other branches
  1. 9 core/modules/mysql/src/Driver/Database/mysql/Schema.php \Drupal\mysql\Driver\Database\mysql\Schema::buildTableNameCondition()
  2. 9 core/lib/Drupal/Core/Database/Schema.php \Drupal\Core\Database\Schema::buildTableNameCondition()
  3. 8.9.x core/lib/Drupal/Core/Database/Driver/mysql/Schema.php \Drupal\Core\Database\Driver\mysql\Schema::buildTableNameCondition()
  4. 8.9.x core/lib/Drupal/Core/Database/Schema.php \Drupal\Core\Database\Schema::buildTableNameCondition()
  5. 10 core/modules/mysql/src/Driver/Database/mysql/Schema.php \Drupal\mysql\Driver\Database\mysql\Schema::buildTableNameCondition()
  6. 10 core/lib/Drupal/Core/Database/Schema.php \Drupal\Core\Database\Schema::buildTableNameCondition()

Build a condition to match a table name against a standard information_schema.

MySQL uses databases like schemas rather than catalogs so when we build a condition to query the information_schema.tables, we set the default database as the schema unless specified otherwise, and exclude table_catalog from the condition criteria.

Overrides Schema::buildTableNameCondition

1 call to Schema::buildTableNameCondition()
Schema::getComment in core/modules/mysql/src/Driver/Database/mysql/Schema.php
Retrieve a table or column comment.

File

core/modules/mysql/src/Driver/Database/mysql/Schema.php, line 77

Class

Schema
MySQL implementation of <a href="/api/drupal/core%21lib%21Drupal%21Core%21Database%21Schema.php/class/Schema/11.x" title="Provides a base implementation for Database Schema." class="local">\Drupal\Core\Database\Schema</a>.

Namespace

Drupal\mysql\Driver\Database\mysql

Code

protected function buildTableNameCondition($table_name, $operator = '=', $add_prefix = TRUE) {
    $table_info = $this->getPrefixInfo($table_name, $add_prefix);
    $condition = $this->connection
        ->condition('AND');
    $condition->condition('table_schema', $table_info['database']);
    $condition->condition('table_name', $table_info['table'], $operator);
    return $condition;
}

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