Skip to content

Commit 78f672c

Browse files
committed
fix: Fixed fetch method when you call same SQL more than once
1 parent 05e3fd7 commit 78f672c

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

db.class.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,9 @@ private static function encapsulate($mixed)
137137
$instance = new dbObject(self::getInstance()->query($mixed), array("key" => $key));
138138
self::$object[$key] = $instance;
139139
}
140-
if (self::$object[$key]->extra["rows"] === self::$object[$key]->extra["totalEntries"]) {
140+
if (self::$object[$key]->extra["rows"] + 1 == self::$object[$key]->extra["totalEntries"] || self::$object[$key]->extra["rows"] + 1 >= self::$object[$key]->extra["totalEntries"]) {
141141
unset(self::$object[$key]);
142-
return false;
142+
return self::encapsulate($mixed);
143143
}
144144
return self::$object[$key];
145145
}
@@ -162,7 +162,8 @@ public static function fetch($mixed, $simple = false)
162162
}
163163
}
164164
$mixed = self::encapsulate($mixed);
165-
return ($mixed ? $mixed->getData() : $mixed);
165+
return $mixed->getData();
166+
//return ($mixed ? $mixed->getData() : $mixed);
166167
}
167168
if ($mixed instanceof dbObject) {
168169
return $mixed->getData();

0 commit comments

Comments
 (0)