function QueryTest::testQuotingIdentifiers

Same name in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/Database/QueryTest.php \Drupal\KernelTests\Core\Database\QueryTest::testQuotingIdentifiers()
  2. 10 core/tests/Drupal/KernelTests/Core/Database/QueryTest.php \Drupal\KernelTests\Core\Database\QueryTest::testQuotingIdentifiers()

Tests quoting identifiers in queries.

File

core/tests/Drupal/KernelTests/Core/Database/QueryTest.php, line 153

Class

QueryTest
Tests Drupal's extended prepared statement syntax.

Namespace

Drupal\KernelTests\Core\Database

Code

public function testQuotingIdentifiers() : void {
    // Use the table named an ANSI SQL reserved word with a column that is as
    // well.
    $result = $this->connection
        ->query('SELECT [update] FROM {select}')
        ->fetchObject();
    $this->assertEquals('Update value 1', $result->update);
}

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