DB_NestedSet
[ class tree: DB_NestedSet ] [ index: DB_NestedSet ] [ all elements ]

Source for file DB.php

Documentation is available at DB.php

  1. <?php 
  2.  
  3. // +----------------------------------------------------------------------+
  4. // | PEAR :: DB_NestedSet_DB                                              |
  5. // +----------------------------------------------------------------------+
  6. // | Copyright (c) 1997-2003 The PHP Group                                |
  7. // +----------------------------------------------------------------------+
  8. // | This source file is subject to version 2.0 of the PHP license,       |
  9. // | that is bundled with this package in the file LICENSE, and is        |
  10. // | available at through the world-wide-web at                           |
  11. // | http://www.php.net/license/2_02.txt.                                 |
  12. // | If you did not receive a copy of the PHP license and are unable to   |
  13. // | obtain it through the world-wide-web, please send a note to          |
  14. // | license@php.net so we can mail you a copy immediately.               |
  15. // +----------------------------------------------------------------------+
  16. // | Authors: Daniel Khan <dk@webcluster.at>                              |
  17. // +----------------------------------------------------------------------+
  18.  
  19. // $Id: DB.php,v 1.14 2004/04/02 00:15:06 datenpunk Exp $
  20.  
  21. require_once 'DB.php';
  22. // {{{ DB_NestedSet_DB:: class
  23. /**
  24.  * Wrapper class for PEAR::DB
  25.  * 
  26.  * @author Daniel Khan <dk@webcluster.at>
  27.  * @package DB_NestedSet
  28.  * @version $Revision: 1.14 $
  29.  * @access public
  30.  */
  31. // }}}
  32. class DB_NestedSet_DB extends DB_NestedSet {
  33.     // {{{ properties
  34.     /**
  35.      * 
  36.      * @var object Db object
  37.      */
  38.     var $db
  39.     // }}}
  40.     // {{{ constructor
  41.     /**
  42.      * Constructor
  43.      * 
  44.      * @param mixed $dsn DSN as PEAR dsn URI or dsn Array
  45.      * @param array $params Database column fields which should be returned
  46.      */
  47.     function DB_NestedSet_DB($dsn$params = array()) {
  48.         $this->_debugMessage('DB_NestedSet_DB($dsn, $params = array())');
  49.         $this->DB_NestedSet($params);
  50.         $this->db = $this->_db_Connect($dsn);
  51.         $this->db->setFetchMode(DB_FETCHMODE_ASSOC);
  52.     
  53.     // }}}
  54.     // {{{ destructor
  55.     /**
  56.      * Destructor
  57.      */
  58.     function _DB_NestedSet_DB({
  59.         $this->_debugMessage('_DB_NestedSet_DB()');
  60.         $this->_DB_NestedSet();
  61.         $this->_db_Disconnect();
  62.     
  63.     // }}}
  64.     // {{{ _db_Connect()
  65.     /**
  66.      * Connects to the db
  67.      * 
  68.      * @return object DB The database object
  69.      * @access private
  70.      */
  71.     function _db_Connect($dsn{
  72.         $this->_debugMessage('_db_Connect($dsn)');
  73.         if (DB::isConnection($this->db)) {
  74.             return $this->db;
  75.         
  76.         if (DB::isConnection($dsn)) {
  77.             return $dsn;
  78.         
  79.         $db DB::connect($dsn);
  80.         $this->_testFatalAbort($db__FILE____LINE__);
  81.         return $db;
  82.     
  83.     // }}}
  84.     // {{{ _numRows()
  85.     function _numRows($res{
  86.         return $res->numRows();
  87.     
  88.     // }}}
  89.     // {{{ _isDBError()
  90.     function _isDBError($err{
  91.         if (!DB::isError($err)) {
  92.             return false;
  93.         
  94.         return true;
  95.     
  96.     // }}}
  97.     // {{{ _quote()
  98.     function _quote($str{
  99.         if (method_exists($this->db'quoteSmart')) {
  100.             return $this->db->quoteSmart($str);
  101.         
  102.         return $this->db->quote($str);
  103.     
  104.     // }}}
  105.     // {{{ _quoteIdentifier()
  106.     function _quoteIdentifier($str{
  107.         if (method_exists($this->db'quoteIdentifier')) {
  108.             return $this->db->quoteIdentifier($str);
  109.         
  110.         return $this->_quote($str);
  111.     
  112.     // }}}
  113.     // {{{ _dropSequence()
  114.     function _dropSequence($sequence{
  115.         return $this->db->dropSequence($this->sequence_table);
  116.     
  117.     // }}}
  118.     // {{{ _nextId()
  119.     function _nextId($sequence{
  120.         return $this->db->nextId($sequence);
  121.     
  122.     // }}}
  123.     // {{{ _getAll()
  124.     function _getAll($sql{
  125.         return $this->db->getAll($sqlnullDB_FETCHMODE_ASSOC);
  126.     
  127.     // }}}
  128.     // {{{ _db_Disconnect()
  129.     /**
  130.      * Disconnects from db
  131.      * 
  132.      * @return void 
  133.      * @access private
  134.      */
  135.     function _db_Disconnect({
  136.         $this->_debugMessage('_db_Disconnect()');
  137.         if (is_object($this->db)) {
  138.             @$this->db->disconnect();
  139.         
  140.  
  141.         return true;
  142.     
  143.     // }}}
  144.  
  145. ?>

Documentation generated on Mon, 11 Mar 2019 10:14:32 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.