Source for file Result.php
Documentation is available at Result.php
// +----------------------------------------------------------------------+
// +----------------------------------------------------------------------+
// | Copyright (c) 1997-2003 The PHP Group |
// +----------------------------------------------------------------------+
// | This source file is subject to version 2.02 of the PHP license, |
// | that is bundled with this package in the file LICENSE, and is |
// | available at through the world-wide-web at |
// | http://www.php.net/license/2_02.txt. |
// | If you did not receive a copy of the PHP license and are unable to |
// | obtain it through the world-wide-web, please send a note to |
// | license@php.net so we can mail you a copy immediately. |
// +----------------------------------------------------------------------+
// | Author: Wolfram Kriesing, Paolo Panto, vision:produktion <wk@visionp.de>
// +----------------------------------------------------------------------+
// $Id: Result.php,v 1.7 2004/04/27 23:36:38 quipo Exp $
* this result actually contains the 'data' itself, the number of rows
* returned and some additional info
* using ZE2 you can also get retreive data from the result doing the following:
* <vp_DB_Common-instance>->getAll()->getCount()
* <vp_DB_Common-instance>->getAll()->getData()
* @author Wolfram Kriesing <wolfram@kriesing.de>
var $_dataKeys = array ();
* the counter for the methods getFirst, getNext
// {{{ DB_QueryTool_Result()
* create a new instance of result with the data returned by the query
* @author Wolfram Kriesing <wolfram@kriesing.de>
* @param array the data returned by the result
list ($firstElement) = $data;
if (is_array($firstElement)) { // is the array a collection of rows?
$this->_count = sizeof($data);
* return the number of rows returned. This is an alias for getCount().
* return the number of rows returned
* @author Wolfram Kriesing <wolfram@kriesing.de>
* @return integer the number of rows returned
* get all the data returned
* @author Wolfram Kriesing <wolfram@kriesing.de>
* @return mixed array or PEAR_Error
if ($this->_data[$key]) {
return $this->_data[$key];
return new PEAR_Error (" there is no element with the key '$key'!" );
* get the first result set
* we are not using next, current, and reset, since those ignore keys
* @author Wolfram Kriesing <wolfram@kriesing.de>
return $this->_data[$this->_dataKeys[$this->_counter]];
return new PEAR_Error ('There are no elements!');
* Get next result set. If getFirst() has never been called before,
if (!$this->initDone ()) {
return $this->_data[$this->_dataKeys[$this->_counter]];
return new PEAR_Error ('there are no more elements!');
* check if there are other rows
if ($this->_counter+1 < $this->getCount()) {
* This function emulates PEAR::DB fetchRow() method.
* With this method, DB_QueryTool can transparently replace PEAR_DB
* @todo implement fetchmode support?
if (!PEAR ::isError ($arr)) {
* Helper method. Check if $this->_dataKeys has been initialized
isset ($this->_dataKeys) &&
Documentation generated on Mon, 11 Mar 2019 13:57:13 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|