Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SqlServerConnection::transaction() should use PDO transactions with sqlsrv driver (see issue #1882) #1883

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/Illuminate/Database/SqlServerConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ class SqlServerConnection extends Connection {
*/
public function transaction(Closure $callback)
{
// Microsoft SQL Server driver for pdo (pdo_sqlsrv, driver name sqlsrv)
// correctly supports PDO transactions, and will throw an error if you
// don't use them. As a result, if using this driver we'd rather use the
// generic PDO transaction implementation.
if ($this->getDriverName() == 'sqlsrv') return parent::transaction($callback);

$this->pdo->exec('BEGIN TRAN');

// We'll simply execute the given callback within a try / catch block
Expand Down