public function DatabaseReservedKeywordTestCase::testTableNameQuoting in Drupal 7
File
- modules/simpletest/tests/database_test.test, line 4281
Class
- DatabaseReservedKeywordTestCase
- Test reserved keyword handling (introduced for MySQL 8+)
Code
public function testTableNameQuoting() {
$record = db_query('SELECT * FROM {system} LIMIT 1')
->fetchObject();
$this
->assertTrue(isset($record->filename), 'Successfully queried the {system} table.');
$connection = Database::getConnection()
->getConnectionOptions();
if ($connection['driver'] === 'sqlite') {
$this
->assert(TRUE, 'Skipping schema.{system} test for SQLite.');
}
else {
$database = $connection['database'];
db_query('SELECT * FROM ' . $database . '.{system} LIMIT 1')
->fetchObject();
$this
->assertTrue(isset($record->filename), 'Successfully queried the schema.{system} table.');
}
}