Skip to content
Permalink
Browse files

Trim $sql before checking for SELECT

  • Loading branch information...
Joseph Woodruff
Joseph Woodruff committed Apr 11, 2014
1 parent 9971545 commit 9aeea2fcc3362076a946adcb9d072ccd8fb28bca
Showing with 1 addition and 0 deletions.
  1. +1 −0 lib/Cake/Model/Datasource/Database/Sqlserver.php
@@ -756,6 +756,7 @@ public function lastAffected($source = null) {
*/
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);

0 comments on commit 9aeea2f

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.