function EndOfTransactionQueriesTest::isStatementRelatedToTable
Same name in other branches
- 10 core/tests/Drupal/KernelTests/Core/Cache/EndOfTransactionQueriesTest.php \Drupal\KernelTests\Core\Cache\EndOfTransactionQueriesTest::isStatementRelatedToTable()
Determines if a statement is relative to a specified table.
Non-core database drivers can override this method if they have different patterns to identify table related statements.
Parameters
string $statement: The query statement.
string $tableName: The table name, Drupal style, without curly brackets or prefix.
Return value
bool TRUE if the statement is relative to the table, FALSE otherwise.
1 call to EndOfTransactionQueriesTest::isStatementRelatedToTable()
- EndOfTransactionQueriesTest::getStatementsForTable in core/
tests/ Drupal/ KernelTests/ Core/ Cache/ EndOfTransactionQueriesTest.php - Filters statements by table name.
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Cache/ EndOfTransactionQueriesTest.php, line 183
Class
- EndOfTransactionQueriesTest
- Tests delaying of cache tag invalidation queries to the end of transactions.
Namespace
Drupal\KernelTests\Core\CacheCode
protected static function isStatementRelatedToTable(string $statement, string $tableName) : bool {
$realTableIdentifier = Database::getConnection()->prefixTables('{' . $tableName . '}');
$pattern = '/.*(INTO|FROM|UPDATE)( |\\n)' . preg_quote($realTableIdentifier, '/') . '/';
return preg_match($pattern, $statement) === 1 ? TRUE : FALSE;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.