diff --git a/src/Db/Connection.php b/src/Db/Connection.php index 1c9e613..f33d4c3 100644 --- a/src/Db/Connection.php +++ b/src/Db/Connection.php @@ -23,7 +23,7 @@ class Connection * @return OdbcResultSet|resource|string * @throws SqlException */ - public static function execute($sql, $values = array(), $fetchMode = \PDO::FETCH_ASSOC) + public static function execute($sql, $values = array(), $fetchMode = \PDO::FETCH_ASSOC, $hasOutput = null) { $statement = PDOWithFilters::prepare($sql); $success = $statement->execute(!empty($values) ? $values : null); @@ -32,7 +32,7 @@ class Connection throw new SqlException('SQL There was an error executing the request'); } - if (strpos($sql, "SELECT") !== false || strpos($sql, "OUTPUT INSERTED") !== false) { + if ((strpos($sql, "SELECT") < 6 || strpos($sql, "OUTPUT INSERTED") !== false) && (($hasOutput !== null && $hasOutput !== false) || $hasOutput === null)) { $rows = $statement->fetchAll($fetchMode); if (!is_array($rows)) { throw new SqlException('PDO Unable to retrieve the result');