iterator = 0; $this->numRows = 0; //echo "dsn:[$dsn] usr:[$usr] pwd:[$pwd]"; //echo "schema:[$schema] dbConnectionType:[$dbConnectionType]
"; $this->con = NewADOConnection($dbConnectionType); $this->con->Connect($dsn, $usr, $pwd, $schema); //$this->con->SetFetchMode(ADODB_FETCH_ASSOC); } function prepforSQL($unsafeSQL_Insert){ $safeSQL = $this->con->qstr($unsafeSQL_Insert); return $safeSQL; } function query($query){ $this->close(); $this->dbconnect(); $returned = $this->con->EXECUTE($query); $temp = array(); //echo "returned->_numOfRows:[" . $returned->_numOfRows. "]"; if ($returned->_numOfRows > 0){ $temp = $returned->GetArray(); $this->numRows = $returned->_numOfRows; } $lowerArray = array(); for ($i = 0; $i < sizeof($temp); $i++){ $individualRecord = $temp[$i]; $loweredIndividualRecord = array(); //print_r($individualRecord); foreach ($individualRecord as $key => $value){ $key = strtolower($key); $loweredIndividualRecord[$key] = $value; $lowerArray[$i] = $loweredIndividualRecord; } } $this->values = $lowerArray; } function f($find){ $returned = ""; if (sizeof($this->values) > 0){ $find = strtolower($find); $returned = $this->values[$this->iterator][$find]; } return $returned; } function has_element(){ $return = false; if (sizeof($this->values) > 0){ $return = true; } return $return; } function num_rows(){ return sizeof($this->values); } function next_record(){ $ok = true; if (($this->iterator + 1) > (sizeof($this->values) - 1)){ $ok = false; } else { $this->iterator = $this->iterator + 1; } return $ok; } function close(){ $this->con->close(); } } ?>