mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
Impriving documentation
This commit is contained in:
parent
7e2fe43ee3
commit
c016f1d97b
2 changed files with 9 additions and 9 deletions
|
@ -267,17 +267,15 @@ class DboMysql extends DboSource {
|
|||
/**
|
||||
* Returns a formatted error message from previous database operation.
|
||||
*
|
||||
* @param PDOStatement $query the query to extract the error from if any
|
||||
* @return string Error message with error number
|
||||
*/
|
||||
function lastError() {
|
||||
if ($this->hasResult()) {
|
||||
$error = $this->_result->errorInfo();
|
||||
if (empty($error)) {
|
||||
$error;
|
||||
}
|
||||
return $error[1] . ': ' . $error[2];
|
||||
function lastError(PDOStatement $query = null) {
|
||||
$error = $query->errorInfo();
|
||||
if (empty($error[2])) {
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
return $error[1] . ': ' . $error[2];
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -242,6 +242,7 @@ class DboSource extends DataSource {
|
|||
public function execute($sql, $options = array(), $params = array()) {
|
||||
$defaults = array('stats' => true, 'log' => $this->fullDebug);
|
||||
$options = array_merge($defaults, $options);
|
||||
$this->error = null;
|
||||
|
||||
$t = microtime(true);
|
||||
$this->_result = $this->_execute($sql, $params);
|
||||
|
@ -274,7 +275,8 @@ class DboSource extends DataSource {
|
|||
$query = $this->_connection->prepare($sql);
|
||||
$query->setFetchMode(PDO::FETCH_LAZY);
|
||||
if (!$query->execute($params)) {
|
||||
$this->error = $this->lastError();
|
||||
$this->_results = $query;
|
||||
$this->error = $this->lastError($query);
|
||||
return false;
|
||||
}
|
||||
if (!$query->columnCount()) {
|
||||
|
|
Loading…
Reference in a new issue