From 26fcce650aa4e4deffa9182efa604d3a0087fde0 Mon Sep 17 00:00:00 2001 From: Brian Cash Date: Sat, 22 Jun 2013 11:56:01 -0700 Subject: [PATCH] Passes mysqli error code to MeekroDBException --- db.class.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/db.class.php b/db.class.php index a5961d6..acfcc37 100644 --- a/db.class.php +++ b/db.class.php @@ -614,12 +614,13 @@ class MeekroDB { call_user_func($error_handler, array( 'type' => 'sql', 'query' => $sql, - 'error' => $db->error + 'error' => $db->error, + 'code' => $db->errno )); } if ($this->throw_exception_on_error) { - $e = new MeekroDBException($db->error, $sql); + $e = new MeekroDBException($db->error, $sql, $db->errno); throw $e; } } else if ($this->success_handler) { @@ -840,9 +841,10 @@ class DBTransaction { class MeekroDBException extends Exception { protected $query = ''; - function __construct($message='', $query='') { + function __construct($message='', $query='', $code = 0) { parent::__construct($message); $this->query = $query; + $this->code = $code; } public function getQuery() { return $this->query; }