mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-09-05 02:52:41 +00:00
Catching the error in execute for SQL Server to have the same behavior from the others drivers.
This commit is contained in:
parent
195653bdfc
commit
e049e35b5d
2 changed files with 10 additions and 3 deletions
|
@ -705,7 +705,7 @@ class Mssql extends DboSource {
|
|||
* @param string $sql SQL statement
|
||||
* @param array $params list of params to be bound to query (supported only in select)
|
||||
* @param array $prepareOptions Options to be used in the prepare statement
|
||||
* @return PDOStatement if query executes with no problem, true as the result of a succesfull
|
||||
* @return mixed PDOStatement if query executes with no problem, true as the result of a succesfull, false on error
|
||||
* query returning no rows, suchs as a CREATE statement, false otherwise
|
||||
*/
|
||||
protected function _execute($sql, $params = array(), $prepareOptions = array()) {
|
||||
|
@ -713,7 +713,14 @@ class Mssql extends DboSource {
|
|||
$prepareOptions += array(PDO::ATTR_CURSOR => PDO::CURSOR_SCROLL);
|
||||
return parent::_execute($sql, $params, $prepareOptions);
|
||||
}
|
||||
return $this->_connection->exec($sql);
|
||||
try {
|
||||
$this->_connection->exec($sql);
|
||||
return true;
|
||||
} catch (PDOException $e) {
|
||||
$this->_results = null;
|
||||
$this->error = $e->getMessage();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -451,7 +451,7 @@ class DboSource extends DataSource {
|
|||
* @param string $sql SQL statement
|
||||
* @param array $params list of params to be bound to query
|
||||
* @param array $prepareOptions Options to be used in the prepare statement
|
||||
* @return PDOStatement if query executes with no problem, true as the result of a succesfull
|
||||
* @return mixed PDOStatement if query executes with no problem, true as the result of a succesfull, false on error
|
||||
* query returning no rows, suchs as a CREATE statement, false otherwise
|
||||
*/
|
||||
protected function _execute($sql, $params = array(), $prepareOptions = array()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue