Location: PHPKode > projects > web.framework > web.framework-1.0.0/web.framework/DB/Drivers/ODBTP/ODBTPRecordSet.class.php
<?php
/**
 * Project:     web.framework: the PHP5 MVC framework
 * File:		ODBTPRecordSet.class.php
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * You may contact the authors of web.framework by e-mail at:
 * hide@address.com
 *
 * The latest version of web.framework can be obtained from:
 * http://sourceforge.net/projects/webframework
 *
 * @link http://sourceforge.net/projects/webframework
 * @copyright 2005 Marcin Staniszczak
 * @author Marcin Staniszczak <hide@address.com>
 * @version 1.0.0
 */

require_once(WEBDB_CORE_DIR.'WebDBRecordSet.abstract.class.php');

/**
 * RecordSet class for ODBTP's driver
 *
 * @name ODBTPRecordSet
 * @version 1.0.0
 * @package web.framework
 * @subpackage web.db
 *
 * @author Marcin Staniszczak
 * @copyright 2005 Marcin Staniszczak
 */
class ODBTPRecordSet extends AWebDBRecordSet {
	/**
	 * Set pointer on the next record
	 *
	 * @access public
	 * @param integer position
	 */
	public function seek($intPosition) {
		if (!@odbtp_data_seek($this->resResult, $intPosition)) {
			return false;
		}

		$this->intCursorPos = $intPosition;
		return true;
	}

	/**
	 * Go to the next record
	 *
	 * @access public
	 * @return true - all it's ok, false - no new records
	 */
	public function next() {
		$arrFields = null;

		if ($this->intFetchMode === AWebDBRecordSet::FETCHMODE_ASSOC) {
			$arrFields = odbtp_fetch_assoc($this->resResult);
		} else {
			$arrFields = odbtp_fetch_array($this->resResult);
		}
		//@mysql_fetch_array($this->resResult, $this->getFetchMode());

		if (!$arrFields) {
			if (strlen(odbtp_get_error($this->getResource())) == 0) {
				return false;
			} else {
				throw new WD_RecordSet_Exception(Languages::$MESSAGES[WebDB::$strLanguage]['EXCEPTIONS']['WEBDB']['RECORD_SET']['FETCHING_RESULT'], odbtp_get_error($this->getResource()));
			}
		}

		if ($this->intAssocCase == AWebDBRecordSet::ASSOCCASE_ORGINAL) {
			$this->arrFields = $arrFields;
		} elseif ($this->intAssocCase == AWebDBRecordSet::ASSOCCASE_LOWER) {
			$this->arrFields = array_change_key_case($arrFields, CASE_LOWER);
		} else {
			$this->arrFields = array_change_key_case($arrFields, CASE_UPPER);
		}

		$this->intCursorPos++;

		return true;
	}

	/**
	 * Close query results resource
	 *
	 * @access public
	 */
	public function close() {
		@odbtp_free_query($this->resResult);
	}

	/**
	 * Return records number
	 *
	 * @access public
	 * @return integer records number
	 */
	public function count() {
        $intRows = odbtp_num_rows($this->resResult);

        if ($intRows === null) {
        	throw new WD_RecordSet_Exception(Languages::$MESSAGES[WebDB::$strLanguage]['EXCEPTIONS']['WEBDB']['RECORD_SET']['NUM_ROWS'], odbtp_get_error($this->getResource()));
        }
		echo '???'.$intRows;

        return $intRows;
	}
}
?>
Return current item: web.framework