From 9aeea2fcc3362076a946adcb9d072ccd8fb28bca Mon Sep 17 00:00:00 2001 From: Joseph Woodruff Date: Fri, 11 Apr 2014 15:25:07 -0600 Subject: [PATCH] Trim $sql before checking for SELECT --- lib/Cake/Model/Datasource/Database/Sqlserver.php | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/Cake/Model/Datasource/Database/Sqlserver.php b/lib/Cake/Model/Datasource/Database/Sqlserver.php index b6b0c4bf2..972c10809 100644 --- a/lib/Cake/Model/Datasource/Database/Sqlserver.php +++ b/lib/Cake/Model/Datasource/Database/Sqlserver.php @@ -756,6 +756,7 @@ class Sqlserver extends DboSource { */ protected function _execute($sql, $params = array(), $prepareOptions = array()) { $this->_lastAffected = false; + $sql = trim($sql); if (strncasecmp($sql, 'SELECT', 6) === 0 || preg_match('/^EXEC(?:UTE)?\s/mi', $sql) > 0) { $prepareOptions += array(PDO::ATTR_CURSOR => PDO::CURSOR_SCROLL); return parent::_execute($sql, $params, $prepareOptions);