| 1 | <?php |
| 2 | |
| 3 | class result extends PDOStatement { |
| 4 | //All functions in this class are deprecated! |
| 5 | //Please use only native PDOStatement functions! |
| 6 | |
| 7 | var $_numRows = 0; |
| 8 | var $_numFields = 0; |
| 9 | var $_currentRow = -1; |
| 10 | var $_currentRecord = array(); |
| 11 | var $_queryId = false; |
| 12 | var $_sql = ""; |
| 13 | |
| 14 | public $dbh; |
| 15 | protected function __construct($dbh) { |
| 16 | $this->dbh = $dbh; |
| 17 | |
| 18 | $this->_numRows = @$this->rowCount(); |
| 19 | //$this->_numFields = @mysql_num_fields($this->_queryId); |
| 20 | $this->_currentRow = -1; |
| 21 | $this->_currentRecord = array(); |
| 22 | } |
| 23 | |
| 24 | function next() { //DEPRECATED!!! Use $this->fetch(); instead!!! |
| 25 | if ($this->_currentRow + 1 >= $this->_numRows) { |
| 26 | return false; |
| 27 | } else { |
| 28 | $this->_currentRecord = @$this->fetch(); |
| 29 | $this->_currentRow++; |
| 30 | return true; |
| 31 | } |
| 32 | } |
| 33 | |
| 34 | function getRecord() { //DEPRECATED!!! Use $this->fetch(); instead!!! |
| 35 | return $this->_currentRecord; |
| 36 | } |
| 37 | |
| 38 | function getString($column) { //DEPRECATED!!! Use $this->fetch(); instead!!! |
| 39 | if (is_int($column) == true) { |
| 40 | return (string) $this->_currentRecord[$column - 1]; |
| 41 | } else { |
| 42 | return (string) isset($this->_currentRecord["$column"]) ? $this->_currentRecord["$column"]: ""; |
| 43 | } |
| 44 | } |
| 45 | |
| 46 | function getInt($column) { //DEPRECATED!!! Use $this->fetch(); instead!!! |
| 47 | return $this->getString($column); //Dynamic typing OMG... |
| 48 | } |
| 49 | |
| 50 | function getNumRows() { //DEPRECATED!!! Use $this->rowCount(); instead!!! |
| 51 | return $this->_numRows; |
| 52 | } |
| 53 | |
| 54 | } |
| 55 | |