Commit 0890ad90 authored by Nagy Imre's avatar Nagy Imre

adding support for error codes

parent f724dff8
......@@ -106,6 +106,13 @@ class MysqliDb
*/
protected $_stmtError;
/**
* Variable which holds last statement error number
*
* @var int
*/
protected $_stmtErrno;
/**
* Database credentials
* @var string
......@@ -393,6 +400,7 @@ class MysqliDb
$stmt->execute();
$this->count = $stmt->affected_rows;
$this->_stmtError = $stmt->error;
$this->_stmtErrno = $stmt->errno;
$this->_lastQuery = $this->replacePlaceHolders($this->_query, $params);
$res = $this->_dynamicBindResults($stmt);
$this->reset();
......@@ -464,6 +472,7 @@ class MysqliDb
$stmt = $this->_buildQuery($numRows);
$stmt->execute();
$this->_stmtError = $stmt->error;
$this->_stmtErrno = $stmt->errno;
$res = $this->_dynamicBindResults($stmt);
$this->reset();
......@@ -555,6 +564,7 @@ class MysqliDb
$stmt->execute();
$this->_stmtError = $stmt->error;
$this->_stmtErrno = $stmt->errno;
$res = $this->_dynamicBindResults($stmt);
$this->reset();
......@@ -676,6 +686,7 @@ class MysqliDb
$status = $stmt->execute();
$this->reset();
$this->_stmtError = $stmt->error;
$this->_stmtErrno = $stmt->errno;
$this->count = $stmt->affected_rows;
return $status;
......@@ -707,6 +718,7 @@ class MysqliDb
$stmt = $this->_buildQuery($numRows);
$stmt->execute();
$this->_stmtError = $stmt->error;
$this->_stmtErrno = $stmt->errno;
$this->reset();
return ($stmt->affected_rows > 0);
......@@ -1037,6 +1049,7 @@ class MysqliDb
$stmt = $this->_buildQuery(null, $insertData);
$status = $stmt->execute();
$this->_stmtError = $stmt->error;
$this->_stmtErrno = $stmt->errno;
$haveOnDuplicate = !empty ($this->_updateColumns);
$this->reset();
$this->count = $stmt->affected_rows;
......@@ -1583,6 +1596,15 @@ class MysqliDb
return trim($this->_stmtError . " " . $this->mysqli()->error);
}
/**
* Method returns mysql error number
*
* @return int
*/
public function getLastErrno () {
return $this->_stmtErrno;
}
/**
* Mostly internal method to get query and its params out of subquery object
* after get() and getAll()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment