Skip to content

Commit

Permalink
A single maginca setting that fixed 300 tests in SQLServer.
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzo committed Apr 12, 2014
1 parent 4d6f809 commit 4aa23fc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions src/Database/Driver/Sqlserver.php
Expand Up @@ -60,7 +60,7 @@ public function connect() {
$config['flags'][PDO::SQLSRV_ATTR_ENCODING] = $config['encoding'];
}
if (empty($config['dsn'])) {
$config['dsn'] = "sqlsrv:Server={$config['host']};Database={$config['database']}";
$config['dsn'] = "sqlsrv:Server={$config['host']};Database={$config['database']};MultipleActiveResultSets=false";
}

$this->_connect($config);
Expand Down Expand Up @@ -90,7 +90,6 @@ public function enabled() {
return in_array('sqlsrv', PDO::getAvailableDrivers());
}


/**
* Prepares a sql statement to be executed
*
Expand All @@ -100,7 +99,7 @@ public function enabled() {
public function prepare($query) {
$this->connect();
$statement = $this->_connection->prepare((string)$query, [PDO::ATTR_CURSOR => PDO::CURSOR_SCROLL]);
return $this->_old = new PDOStatement($statement, $this);
return new PDOStatement($statement, $this);
}

}
2 changes: 1 addition & 1 deletion tests/TestCase/Database/Driver/SqlserverTest.php
Expand Up @@ -51,7 +51,7 @@ public function testConnectionConfigCustom() {
);

$expected = $config;
$expected['dsn'] = 'sqlsrv:Server=foo;Database=bar';
$expected['dsn'] = 'sqlsrv:Server=foo;Database=bar;MultipleActiveResultSets=false';
$expected['flags'] += [
PDO::ATTR_PERSISTENT => false,
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
Expand Down

0 comments on commit 4aa23fc

Please sign in to comment.