[ Index ]
 

Code source de SPIP Agora 1.4

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/Agora1-4/ecrire/include/bd/ -> squel_builder.php (source)

   1  <?php
   2  /*****************************************************
   3  * This file is part of Agora, web based content management system.
   4  *
   5  * Agora is free software; you can redistribute it and/or modify
   6  * it under the terms of the GNU General Public License as published by
   7  * the Free Software Foundation; version 2 of the License.
   8  *
   9  * Agora is distributed in the hope that it will be useful,
  10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12  * GNU General Public License for more details (file "COPYING").
  13  *
  14  * Copyright © Arnaud Martin, Antoine Pitrou et Philippe Rivière.
  15  * List of authors detailed in "copyright_fr.html" file.
  16  * E-mail : agora@sig.premier-ministre.gouv.fr
  17  * Web site : http://www.agora.gouv.fr
  18  *****************************************************/
  19  // Base class for squel builder business persistence abstraction.
  20  //
  21  
  22  if (defined("_BD_SQUEL_BUILDER"))
  23      return;
  24  
  25  define("_BD_SQUEL_BUILDER", "1");
  26  
  27  require_once("PEAR.php");
  28  require_once("DB.php");
  29  require_once dirname(__FILE__). "/metier.php";
  30  
  31  /**
  32   * BD_squel_builder is a base class for squel builder business persistence abstraction implementations, and must be
  33   * inherited by all such.
  34   * @package    BD
  35   * @author  Antoine Angénieux <aangenieux@clever-age.com>
  36   * @author     Erwan Le Bescond <elebescond@clever-age.com>
  37   * @access    public
  38   */
  39  class BD_squel_builder extends BD_metier {
  40      // {{{ properties
  41      // }}}
  42  
  43      // {{{ factory()
  44      function &factory ($dbParameters = null, $dbOptions = null) {
  45          if (file_exists(
  46                  dirname(
  47                      __FILE__). "/" . $dbParameters->_dbEngine . "/squel_builder_" . $dbParameters->_dbEngine . ".php")
  48              == false) {
  49              include_once(dirname(__FILE__). "/common/squel_builder_common.php");
  50              $classname = "BD_squel_builder_common";
  51          }
  52          else {
  53              include_once(
  54                  dirname(
  55                      __FILE__). "/" . $dbParameters->_dbEngine . "/squel_builder_" . $dbParameters->_dbEngine . ".php");
  56              $classname = "BD_squel_builder_" . $dbParameters->_dbEngine;
  57          }
  58  
  59          if (!class_exists($classname)) {
  60              return PEAR::raiseError("Cannot instanciate class $classname", null, null, null, null, null, false);
  61          }
  62  
  63          $obj = &new $classname;
  64          $result = $obj->setDbParameters($dbParameters);
  65  
  66          if ($dbOptions != null) {
  67              $obj->setDbOptions($dbOptions);
  68          }
  69  
  70          if (PEAR::isError($result)) {
  71              return $result;
  72          }
  73          else {
  74              return $obj;
  75          }
  76      }
  77  
  78      // }}}
  79  
  80      // {{{ constructor
  81  
  82      /**
  83       * DB_squel_builder constructor.
  84       *
  85       * @access public
  86       */
  87  
  88  	function BD_squel_builder () { }
  89  
  90  // }}}
  91  }
  92  ?>


Généré le : Sat Feb 24 14:40:03 2007 par Balluche grâce à PHPXref 0.7