6 var $_currentRecord = array();
10 function result($queryId, $sql) {
11 $this->_queryId = $queryId;
13 if ($this->_queryId != false) {
14 $this->_numRows = @mysql_num_rows($this->_queryId);
15 $this->_numFields = @mysql_num_fields($this->_queryId);
16 $this->_currentRow = -1;
17 $this->_currentRecord = array();
19 $this->exception("result failed.");
24 if ($this->_currentRow + 1 >= $this->_numRows) {
27 $this->_currentRecord = @mysql_fetch_assoc($this->_queryId);
33 function absolute($row) {
35 // positive row number
36 @mysql_data_seek($this->_queryId, $row-1);
37 $this->_currentRecord = @mysql_fetch_assoc($this->_queryId);
38 $this->_currentRow = $row;
40 // not implemented yet
42 $this->exception("Cannot absolute position to row 0");
46 function getRecord() {
47 return $this->_currentRecord;
50 function getString($column) {
51 if (is_int($column) == true) {
52 return (string)$this->_currentRecord[$column-1];
54 return (string)$this->_currentRecord["$column"];
58 function getInt($column) {
59 if (is_int($column) == true) {
60 return (int)$this->_currentRecord[$column-1];
62 return (int)$this->_currentRecord["$column"];
66 function getVariable($column) {
67 return (int)$this->_currentRecord["$column"];
71 function getDouble() {
72 if (is_int($column) == true) {
73 return (double)$this->_currentRecord[$column-1];
75 return (double)$this->_currentRecord["$column"];
80 if ($this->_currentRow < 0) {
83 return $this->_currentRow + 1;
87 function getNumRows() {
88 return $this->_numRows;
91 function getNumFields() {
92 return $this->_numFields;
95 function exception($errorMsg) {
96 die("<pre>SQLException: ".$msg."</pre>");