Index: trunk/phase3/includes/db/Database.php |
— | — | @@ -3248,7 +3248,12 @@ |
3249 | 3249 | } |
3250 | 3250 | |
3251 | 3251 | function fetchRow() { |
3252 | | - $this->currentRow = $this->result[$this->pos++]; |
| 3252 | + if ( $this->pos < count( $this->result ) ) { |
| 3253 | + $this->currentRow = $this->result[$this->pos]; |
| 3254 | + } else { |
| 3255 | + $this->currentRow = false; |
| 3256 | + } |
| 3257 | + $this->pos++; |
3253 | 3258 | return $this->currentRow; |
3254 | 3259 | } |
3255 | 3260 | |
— | — | @@ -3260,14 +3265,22 @@ |
3261 | 3266 | |
3262 | 3267 | // Callers want to be able to access fields with $this->fieldName |
3263 | 3268 | function fetchObject() { |
3264 | | - $this->currentRow = $this->result[$this->pos++]; |
3265 | | - return (object)$this->currentRow; |
| 3269 | + $this->fetchRow(); |
| 3270 | + if ( $this->currentRow ) { |
| 3271 | + return (object)$this->currentRow; |
| 3272 | + } else { |
| 3273 | + return false; |
| 3274 | + } |
3266 | 3275 | } |
3267 | 3276 | |
3268 | 3277 | function rewind() { |
3269 | 3278 | $this->pos = 0; |
3270 | 3279 | $this->currentRow = null; |
3271 | 3280 | } |
| 3281 | + |
| 3282 | + function next() { |
| 3283 | + return $this->fetchObject(); |
| 3284 | + } |
3272 | 3285 | } |
3273 | 3286 | |
3274 | 3287 | /** |