function QueryTest::testNumericExpressionSubstitution
Same name in other branches
- 9 core/tests/Drupal/KernelTests/Core/Database/QueryTest.php \Drupal\KernelTests\Core\Database\QueryTest::testNumericExpressionSubstitution()
- 10 core/tests/Drupal/KernelTests/Core/Database/QueryTest.php \Drupal\KernelTests\Core\Database\QueryTest::testNumericExpressionSubstitution()
- 11.x core/tests/Drupal/KernelTests/Core/Database/QueryTest.php \Drupal\KernelTests\Core\Database\QueryTest::testNumericExpressionSubstitution()
Tests numeric query parameter expansion in expressions.
See also
\Drupal\Core\Database\Driver\sqlite\Statement::getStatement()
http://bugs.php.net/bug.php?id=45259
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Database/ QueryTest.php, line 144
Class
- QueryTest
- Tests Drupal's extended prepared statement syntax..
Namespace
Drupal\KernelTests\Core\DatabaseCode
public function testNumericExpressionSubstitution() {
$count_expected = $this->connection
->query('SELECT COUNT(*) + 3 FROM {test}')
->fetchField();
$count = $this->connection
->query('SELECT COUNT(*) + :count FROM {test}', [
':count' => 3,
])
->fetchField();
$this->assertEqual($count, $count_expected);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.