home *** CD-ROM | disk | FTP | other *** search
/ Cricao de Sites - 650 Layouts Prontos / WebMasters.iso / Servidores / xampp-win32-1.6.7-installer.exe / php / PEAR / DB / QueryTool / Result / Object.php
Encoding:
PHP Script  |  2008-07-02  |  3.7 KB  |  108 lines

  1. <?php
  2. /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
  3.  
  4. /**
  5.  * Contains the DB_QueryTool_Result_Row and DB_QueryTool_Result_Object classes
  6.  *
  7.  * PHP versions 4 and 5
  8.  *
  9.  * LICENSE: Redistribution and use in source and binary forms, with or without
  10.  * modification, are permitted provided that the following conditions are met:
  11.  * 1. Redistributions of source code must retain the above copyright
  12.  *    notice, this list of conditions and the following disclaimer.
  13.  * 2. Redistributions in binary form must reproduce the above copyright
  14.  *    notice, this list of conditions and the following disclaimer in the
  15.  *    documentation and/or other materials provided with the distribution.
  16.  * 3. The name of the author may not be used to endorse or promote products
  17.  *    derived from this software without specific prior written permission.
  18.  *
  19.  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
  20.  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  21.  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  22.  * IN NO EVENT SHALL THE FREEBSD PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY
  23.  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  24.  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  25.  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  26.  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  27.  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  28.  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  29.  *
  30.  * @category  Database
  31.  * @package   DB_QueryTool
  32.  * @author    Roman Dostovalov, Com-tec-so S.A.<roman.dostovalov@ctco.lv>
  33.  * @copyright 2004-2006 Roman Dostovalov
  34.  * @license   http://www.debian.org/misc/bsd.license  BSD License (3 Clause)
  35.  * @version   CVS: $Id: Object.php,v 1.6 2007/11/16 20:34:03 quipo Exp $
  36.  * @link      http://pear.php.net/package/DB_QueryTool
  37.  */
  38.  
  39. /**
  40.  * Include parent class
  41.  */
  42. require_once 'DB/QueryTool/Result.php';
  43.  
  44. /**
  45.  * DB_QueryTool_Result_Row class
  46.  *
  47.  * @category  Database
  48.  * @package   DB_QueryTool
  49.  * @author    Roman Dostovalov Com-tec-so S.A. <roman.dostovalov@ctco.lv>
  50.  * @copyright 2004-2006 Roman Dostovalov
  51.  * @license   http://www.debian.org/misc/bsd.license  BSD License (3 Clause)
  52.  * @link      http://pear.php.net/package/DB_QueryTool
  53.  */
  54. class DB_QueryTool_Result_Row
  55. {
  56.     /**
  57.      * create object properties from the array
  58.      *
  59.      * @param array $arr source data to transform into a result row
  60.      */
  61.     function DB_QueryTool_Result_Row($arr)
  62.     {
  63.         foreach ($arr as $key => $value) {
  64.             $this->$key = $value;
  65.         }
  66.     }
  67. }
  68.  
  69. // -----------------------------------------------------------------------------
  70.  
  71. /**
  72.  * DB_QueryTool_Result_Object class
  73.  *
  74.  * @category  Database
  75.  * @package   DB_QueryTool
  76.  * @author    Roman Dostovalov Com-tec-so S.A. <roman.dostovalov@ctco.lv>
  77.  * @copyright 2004-2005 Roman Dostovalov
  78.  * @license   http://www.php.net/license/3_0.txt  PHP License 3.0
  79.  * @link      http://pear.php.net/package/DB_QueryTool
  80.  */
  81. class DB_QueryTool_Result_Object extends DB_QueryTool_Result
  82. {
  83.     // {{{ fetchRow
  84.  
  85.     /**
  86.      * This function emulates PEAR::DB fetchRow() method
  87.      * With this function DB_QueryTool can transparently replace PEAR::DB
  88.      *
  89.      * @return    void
  90.      * @todo implement fetchmode support?
  91.      * @access    public
  92.      */
  93.     function fetchRow()
  94.     {
  95.         $arr = $this->getNext();
  96.         if (!PEAR::isError($arr)) {
  97.             if (is_scalar($arr)) {
  98.                 return $arr;
  99.             }
  100.             $row = new DB_QueryTool_Result_Row($arr);
  101.             return $row;
  102.         }
  103.         return false;
  104.     }
  105.  
  106.     // }}}
  107. }
  108. ?>