function TemporaryQueryTest::countTableRows

Same name in other branches
  1. 8.9.x core/modules/system/tests/src/Functional/Database/TemporaryQueryTest.php \Drupal\Tests\system\Functional\Database\TemporaryQueryTest::countTableRows()

Returns the number of rows of a table.

1 call to TemporaryQueryTest::countTableRows()
TemporaryQueryTest::testTemporaryQuery in core/modules/system/tests/src/Functional/Database/TemporaryQueryTest.php
Confirms that temporary tables work and are limited to one request.

File

core/modules/system/tests/src/Functional/Database/TemporaryQueryTest.php, line 28

Class

TemporaryQueryTest
Tests the temporary query functionality.

Namespace

Drupal\Tests\system\Functional\Database

Code

public function countTableRows($table_name) {
    return Database::getConnection()->select($table_name)
        ->countQuery()
        ->execute()
        ->fetchField();
}

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