From c27a98286fb884681482c6c9c7cbde7b7a45bdd9 Mon Sep 17 00:00:00 2001 From: Rodrigo Pedra Brum Date: Mon, 17 Jul 2017 20:08:30 -0300 Subject: [PATCH] Add option to configure MARS on SqlServer Connections As stated in this docs from Microsoft: https://github.com/Microsoft/msphpsql/wiki/Recommendations-for-improving-the-performance-of-PDO_SQLSRV-and-SQLSRV#1-multiple-active-result-sets-mars > MARS is enabled by default in both SQLSRV and PDO_SQLSRV drivers. There can be some performance drop when MARS is enabled. Existing code optimized to run in the non-MARS world may show a performance dip when run un-modified with MARS. This PR adds the ability to configure MARS on a SqlServer connection --- src/Illuminate/Database/Connectors/SqlServerConnector.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Illuminate/Database/Connectors/SqlServerConnector.php b/src/Illuminate/Database/Connectors/SqlServerConnector.php index a1b8447ab652..ed841e806939 100755 --- a/src/Illuminate/Database/Connectors/SqlServerConnector.php +++ b/src/Illuminate/Database/Connectors/SqlServerConnector.php @@ -126,6 +126,10 @@ protected function getSqlSrvDsn(array $config) $arguments['TrustServerCertificate'] = $config['trust_server_certificate']; } + if (isset($config['multiple_active_resultsets']) && $config['multiple_active_resultsets'] === false) { + $arguments['MultipleActiveResultSets'] = 'false'; + } + return $this->buildConnectString('sqlsrv', $arguments); }