public function DatabaseReservedKeywordTestCase::testInsertReservedWordTable in Drupal 7
File
- modules/
simpletest/ tests/ database_test.test, line 4350
Class
- DatabaseReservedKeywordTestCase
- Test reserved keyword handling (introduced for MySQL 8+)
Code
public function testInsertReservedWordTable() {
$num_records_before = db_query('SELECT COUNT(*) FROM {virtual}')
->fetchField();
db_insert('virtual')
->fields(array(
'function' => 'Inserted function',
))
->execute();
$num_records_after = db_query('SELECT COUNT(*) FROM {virtual}')
->fetchField();
$this
->assertIdentical($num_records_before + 1, (int) $num_records_after, 'Successful insert into a table with a name and column which are reserved words.');
}