function DatabaseReservedKeywordTestCase::testInsertReservedWordTable

File

modules/simpletest/tests/database_test.test, line 4589

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.');
}

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