From fab5a7d2d03e37651c694be22f72cd56c92d0c3b Mon Sep 17 00:00:00 2001 From: Zachary Showers Date: Mon, 15 Jul 2013 13:12:46 -0400 Subject: [PATCH] Made SqlServerConnection use parent transaction method if 'sqlsrv' driver is used. --- src/Illuminate/Database/SqlServerConnection.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Illuminate/Database/SqlServerConnection.php b/src/Illuminate/Database/SqlServerConnection.php index fb4839d7c2b1..41d2599d6038 100755 --- a/src/Illuminate/Database/SqlServerConnection.php +++ b/src/Illuminate/Database/SqlServerConnection.php @@ -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