function DatabaseReservedKeywordTestCase::testMergeReservedWordTable

File

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

Class

DatabaseReservedKeywordTestCase
Test reserved keyword handling (introduced for MySQL 8+)

Code

function testMergeReservedWordTable() {
    $key = db_query('SELECT id FROM {virtual} LIMIT 1')->fetchField();
    $num_records_before = db_query('SELECT COUNT(*) FROM {virtual}')->fetchField();
    db_merge('virtual')->key(array(
        'id' => $key,
    ))
        ->fields(array(
        'function' => 'Merged function',
    ))
        ->execute();
    $num_records_after = db_query('SELECT COUNT(*) FROM {virtual}')->fetchField();
    $this->assertIdentical($num_records_before, $num_records_after, 'Successful merge query on 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.