public function SqlServerSelectTest::testParameterLimit in Drupal driver for SQL Server and SQL Azure 7
Same name and namespace in other branches
- 7.3 tests/sqlsrv.select.test \SqlServerSelectTest::testParameterLimit()
- 7.2 tests/sqlsrv.select.test \SqlServerSelectTest::testParameterLimit()
Test the 2100 parameter limit per query.
File
- tests/
sqlsrv.select.test, line 61 - Support tests for SQL Server.
Class
- SqlServerSelectTest
- @file Support tests for SQL Server.
Code
public function testParameterLimit() {
$values = array();
for ($x = 0; $x < 2200; $x++) {
$values[] = uniqid($x, TRUE);
}
$query = db_select('test_task', 't');
$query
->addExpression('COUNT(task)', 'num');
$query
->where('t.task IN (:data)', array(
':data' => $values,
));
$result = NULL;
// If > 2100 we can get SQL Exception! The driver must handle that.
try {
$result = $query
->execute()
->fetchField();
} catch (\Exception $err) {
}
$this
->assertEqual($result, 0, 'Returned the correct number of total rows.');
}