. ======================================================================*/ if (!function_exists('mysql_connect')) trigger_error('mysql_* functions not defined. Install php*-mysql.', E_USER_ERROR); require_once(dirname(__FILE__) . '/KjwResultSet.php'); /** @ingroup sql * * KjwMyResultSet is an implementation for mysql of the KjwResultSet abstract class. */ class KjwMyResultSet extends KjwResultSet { var $_resource; /**< The MySQL result set resource. */ var $_pointer; /**< A pointer to keep track of the current position. */ var $_end; /**< The size of the result set. */ /** * Construct a KjwMyResultSet. * * @param $resource A mysql result set resource. */ function KjwMyResultSet(&$resource) { parent::KjwResultSet(); $this->_resource = &$resource; $this->_pointer = 0; $this->_end = mysql_num_rows($this->_resource); } /* [INHERITED DOCS] */ function destroy() { mysql_free_result($this->_resource); parent::destroy(); } /* [INHERITED DOCS] */ function getNext() { if ($this->_pointer < $this->size()) { ++$this->_pointer; return mysql_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; mysql_data_seek($this->_resource, $offset); return true; } return false; } } ?>