public function SqlModeTest::testQuotingIdentifiers in Drupal 9
Same name and namespace in other branches
- 10 core/tests/Drupal/KernelTests/Core/Database/SqlModeTest.php \Drupal\KernelTests\Core\Database\SqlModeTest::testQuotingIdentifiers()
Tests quoting identifiers in queries.
File
- core/
tests/ Drupal/ KernelTests/ Core/ Database/ SqlModeTest.php, line 26
Class
- SqlModeTest
- Tests compatibility of the MySQL driver with various sql_mode options.
Namespace
Drupal\KernelTests\Core\DatabaseCode
public function testQuotingIdentifiers() {
// Use SQL-reserved words for both the table and column names.
$query = $this->connection
->query('SELECT [update] FROM {select}');
$this
->assertEquals('Update value 1', $query
->fetchObject()->update);
$this
->assertStringContainsString('SELECT `update` FROM `', $query
->getQueryString());
}