. ======================================================================*/ if (!function_exists('pg_connect')) trigger_error('pg_* functions not defined. Install php*-pgsql.', E_USER_ERROR); require_once(dirname(__FILE__) . '/KjwResultSet.php'); /** @ingroup sql * * KjwPgResultSet is an implementation for postgresql of the KjwResultSet abstract class. */ class KjwPgResultSet extends KjwResultSet { var $_resource; /**< The postgresql result set resource. */ var $_pointer; /**< A pointer to keep track of the current position. */ var $_end; /**< The size of the result set. */ /** * Construct a KjwPgResultSet. * * @param $resource A postgresql result set resource. */ function KjwPgResultSet(&$resource) { parent::KjwResultSet(); $this->_resource = &$resource; $this->_pointer = 0; $this->_end = pg_num_rows($this->_resource); } /* [INHERITED DOCS] */ function destroy() { pg_free_result($this->_resource); parent::destroy(); } /* [INHERITED DOCS] */ function getNext() { if ($this->_pointer < $this->size()) { ++$this->_pointer; return pg_fetch_assoc($this->_resource); } return false; } /* [INHERITED DOCS] */ function at() { return $this->_pointer; } /* [INHERITED DOCS] */ function size() { return $this->_end; } /* [INHERITED DOCS] */ function seekAbs($offset) { if ($offset >= 0 && $offset < $this->_end) { $this->_pointer = $offset; pg_result_seek($this->_resource, $offset); return true; } return false; } } ?>