X-Git-Url: https://git.harvie.cz/?a=blobdiff_plain;ds=sidebyside;f=wwwroot%2Finc%2Fresult.inc;h=ab421a612c789458d810246fc78b3c4879b7b48c;hb=78f1a5f44941de2459b71c375e36cf88227c689c;hp=ce96b198482319f0baf6a8c2942fcf7b54b3f719;hpb=d068d94b5e62de2f80164fd8062adce6e0ad93ae;p=mirrors%2FKyberia-bloodline.git diff --git a/wwwroot/inc/result.inc b/wwwroot/inc/result.inc index ce96b19..ab421a6 100644 --- a/wwwroot/inc/result.inc +++ b/wwwroot/inc/result.inc @@ -1,5 +1,9 @@ _queryId = $queryId; - $this->_sql = $sql; - if ($this->_queryId != false) { - $this->_numRows = @mysql_num_rows($this->_queryId); - $this->_numFields = @mysql_num_fields($this->_queryId); + public $dbh; + protected function __construct($dbh) { + $this->dbh = $dbh; + + $this->_numRows = @$this->rowCount(); + //$this->_numFields = @mysql_num_fields($this->_queryId); $this->_currentRow = -1; $this->_currentRecord = array(); - } else { - $this->exception("result failed."); } -} - function next() { - if ($this->_currentRow + 1 >= $this->_numRows) { - return false; - } else { - $this->_currentRecord = @mysql_fetch_assoc($this->_queryId); - $this->_currentRow++; - return true; + function next() { //DEPRECATED!!! Use $this->fetch(); instead!!! + if ($this->_currentRow + 1 >= $this->_numRows) { + return false; + } else { + $this->_currentRecord = @$this->fetch(); + $this->_currentRow++; + return true; + } } -} -/* DEPRECATED! -function absolute($row) { - if ($row > 0) { -// positive row number - @mysql_data_seek($this->_queryId, $row-1); - $this->_currentRecord = @mysql_fetch_assoc($this->_queryId); - $this->_currentRow = $row; - } elseif ($row < 0) { - // not implemented yet - } else { - $this->exception("Cannot absolute position to row 0"); + function getRecord() { //DEPRECATED!!! Use $this->fetch(); instead!!! + return $this->_currentRecord; } -} -*/ -function getRecord() { - return $this->_currentRecord; -} - -function getString($column) { - if (is_int($column) == true) { - return (string)$this->_currentRecord[$column-1]; - } else { - return (string)$this->_currentRecord["$column"]; + function getString($column) { //DEPRECATED!!! Use $this->fetch(); instead!!! + if (is_int($column) == true) { + return (string) $this->_currentRecord[$column - 1]; + } else { + return (string) $this->_currentRecord["$column"]; + } } -} -function getInt($column) { - if (is_int($column) == true) { - return (int)$this->_currentRecord[$column-1]; - } else { - return (int)$this->_currentRecord["$column"]; + function getInt($column) { //DEPRECATED!!! Use $this->fetch(); instead!!! + $this->getString(); //Dynamic typing OMG... } -} - -/* DEPRECATED! -function getVariable($column) { - return (int)$this->_currentRecord["$column"]; -} - -function getDouble() { - if (is_int($column) == true) { - return (double)$this->_currentRecord[$column-1]; - } else { - return (double)$this->_currentRecord["$column"]; - } -} - -function getRow() { - if ($this->_currentRow < 0) { - return 0; - } else { - return $this->_currentRow + 1; + function getNumRows() { //DEPRECATED!!! Use $this->rowCount(); instead!!! + return $this->_numRows; } -} -*/ - -function getNumRows() { - return $this->_numRows; -} - -/* DEPRECATED! -function getNumFields() { - return $this->_numFields; -} -*/ - -function exception($errorMsg) { //Internal only! - die("
SQLException: ".$msg."
"); -} } -?>