. */ require_once dirname(__FILE__) . "/IResult.php"; class MySQLResult implements IResult { private $result = null; public function __construct($result) { $this->result = $result; } public function __destruct() { if( $this->result != null && $this->result !== false ) { $this->freeResult(); } } /** * Return associative array of last select * * @return array associative array of last select */ public function fetchAssoc() { return $this->result->fetch_assoc(); } /** * Fetch all result rows as an associative array * * @return 2-dimensional array containing all result rows */ public function fetchAssocAll() { $rows = array(); while( $row = $this->fetchAssoc() ) { $rows[] = $row; } return $rows; } /** * Adjusts the result pointer to an arbitrary row in the result * * @param int row */ public function dataSeek($row) { $this->result->data_seek($row); } /** * Free result */ public function freeResult() { $this->result->free(); $this->result = NULL; } /** * Return number of rows in result */ public function numRows() { return $this->result->num_rows; } }