Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

result->first_row() is cached

  • Loading branch information...
commit c0da1e49b1787f89ea3c9700a27457d7b987feab 1 parent d0ffb67
@jaz303 authored
Showing with 7 additions and 2 deletions.
  1. +7 −2 inc/gdb/gdb.php
View
9 inc/gdb/gdb.php
@@ -614,6 +614,8 @@ public function get_usage() {
private $mode_ident = null;
private $mode_options = array();
+ private $first_row_memo = null;
+
/**
* Returns a single field from the first row of this result set. Behaviour
* is undefined if both <tt>value()</tt> and result-set iteration are
@@ -630,8 +632,11 @@ public function get_usage() {
* are used.
*/
public function first_row() {
- $this->next();
- return $this->current();
+ if ($this->first_row_memo === null) {
+ $this->next();
+ $this->first_row_memo = $this->current();
+ }
+ return $this->first_row_memo;
}
/**
Please sign in to comment.
Something went wrong with that request. Please try again.