diff options
author | Dracony <draconyster@gmail.com> | 2013-02-07 20:51:04 +0200 |
---|---|---|
committer | Dracony <draconyster@gmail.com> | 2013-02-07 20:51:04 +0200 |
commit | 479d36a36395b3e15ded793fcb6324f2a3b09ee1 (patch) | |
tree | 892b7368d98f2f8fe7d00065511a4c8385dd1d1a /modules/database/classes/driver/mysql | |
parent | 8a3a1413e2b8cd93cc723d7611a97cb7b9713d65 (diff) | |
download | PHPixie-479d36a36395b3e15ded793fcb6324f2a3b09ee1.zip PHPixie-479d36a36395b3e15ded793fcb6324f2a3b09ee1.tar.gz PHPixie-479d36a36395b3e15ded793fcb6324f2a3b09ee1.tar.bz2 |
more tests and refactoring
Diffstat (limited to 'modules/database/classes/driver/mysql')
-rw-r--r-- | modules/database/classes/driver/mysql/result.php | 94 |
1 files changed, 48 insertions, 46 deletions
diff --git a/modules/database/classes/driver/mysql/result.php b/modules/database/classes/driver/mysql/result.php index ccbdfcf..a2b2a90 100644 --- a/modules/database/classes/driver/mysql/result.php +++ b/modules/database/classes/driver/mysql/result.php @@ -1,47 +1,49 @@ -<?php
-
-/**
- * Database result implementation for Mysqli
- * @package Database
- */
-class Result_Mysql_Driver extends Result_Database {
-
- /**
- * Initializes new result object
- *
- * @param mysqli_result $result Mysqli Result
- * @return void
- * @access public
- * @link http://php.net/manual/en/class.mysqli-result.php
- */
- public function __construct($result) {
- $this->_result = $result;
- }
-
- /**
- * Throws exception if rewind is attempted.
- *
- * @return void
- * @access public
- * @throws Exception If rewind is attempted
- */
- public function rewind() {
- if($this->_position!=0)
- throw new Exception('Mysqli result cannot be rewound for unbuffered queries.');
- }
-
- /**
- * Iterates to the next row in the result set
- *
- * @return void
- * @access public
- */
- public function next() {
- if($this->_fetched)
- $this->_position++;
- $this->_row=$this->_result->fetch_object();
- if ($this->_row == null)
- $this->_result->free();
- }
-
+<?php + +/** + * Database result implementation for Mysqli + * @package Database + */ +class Result_Mysql_Driver extends Result_Database { + + /** + * Initializes new result object + * + * @param mysqli_result $result Mysqli Result + * @return void + * @access public + * @link http://php.net/manual/en/class.mysqli-result.php + */ + public function __construct($result) { + $this->_result = $result; + } + + /** + * Throws exception if rewind is attempted. + * + * @return void + * @access public + * @throws Exception If rewind is attempted + */ + public function rewind() { + if($this->_position>0) + throw new Exception('Mysqli result cannot be rewound for unbuffered queries.'); + } + + /** + * Iterates to the next row in the result set + * + * @return void + * @access public + */ + public function next() { + $this->check_fetched(); + $this->_row = $this->_result->fetch_object(); + if ($this->_row) { + $this->_position++; + }else { + $this->_result->free(); + } + } + }
\ No newline at end of file |