Skip to content

Commit 9910199

Browse files
author
Till Brehm
committed
Fixed error handling problem in mysql db library.
1 parent 6faf141 commit 9910199

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

server/lib/classes/db_mysql.inc.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@ public function updateError($location) {
101101
}
102102
*/
103103
if(mysqli_connect_error()) {
104-
$this->errorNumber = mysqli_connect_errno();
105-
$this->errorMessage = mysqli_connect_error();
104+
$this->errorNumber = $this->connect_errno;
105+
$this->errorMessage = $this->connect_error;
106106
} else {
107107
$this->errorNumber = mysqli_errno($this);
108108
$this->errorMessage = mysqli_error($this);
@@ -137,8 +137,8 @@ public function query($queryString) {
137137
$ok = $this->ping();
138138
if(!$ok) {
139139
if(!$this->real_connect($this->dbHost, $this->dbUser, $this->dbPass, $this->dbName)) {
140+
$this->updateError('DB::query -> reconnect');
140141
if($try > 9) {
141-
$this->updateError('DB::query -> reconnect');
142142
return false;
143143
} else {
144144
sleep(($try > 7 ? 5 : 1));
@@ -150,7 +150,7 @@ public function query($queryString) {
150150
}
151151
} while($ok == false);
152152
$this->queryId = parent::query($queryString);
153-
$this->updateError('DB::query('.$queryString.') -> mysqli_query');
153+
if(!$this->queryId) $this->updateError('DB::query('.$queryString.') -> mysqli_query');
154154
if(!$this->queryId) {
155155
return false;
156156
}
@@ -184,9 +184,9 @@ public function queryOneRecord($queryString) {
184184
// returns the next record in an array
185185
public function nextRecord() {
186186
$this->record = $this->queryId->fetch_assoc();
187-
$this->updateError('DB::nextRecord()-> mysql_fetch_array');
188187
if(!$this->record || !is_array($this->record))
189188
{
189+
$this->updateError('DB::nextRecord()-> mysql_fetch_array');
190190
return false;
191191
}
192192
$this->currentRow++;

0 commit comments

Comments
 (0)