[ 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/ -> service.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 Service.
  20  //
  21  
  22  if (defined("_SERVICE"))
  23      return;
  24  
  25  define("_SERVICE", "1");
  26  
  27  require_once("PEAR.php");
  28  require_once("DB.php");
  29  
  30  require_once dirname(__FILE__). "/metier.php";
  31  
  32  /**
  33   * service is a base class for service persistence abstraction implementations, and must be
  34   * inherited by all such.
  35   * @package    BD
  36   * @author  Antoine Angénieux <aangenieux@clever-age.com>
  37   * @author     Erwan Le Bescond <elebescond@clever-age.com>
  38   * @access    public
  39   *
  40   */
  41  class Service extends BD_metier {
  42  
  43      // {{{ factory()
  44      function &factory ($dbParameters = null, $dbOptions = null) {
  45          if (file_exists(dirname(__FILE__). "/" . $dbParameters->_dbEngine . "/service_" . $dbParameters->_dbEngine . ".php") == false) {
  46              include_once (dirname(__FILE__). "/common/service_common.php");
  47              $classname = "service_common";
  48          }
  49          else {
  50              include_once (dirname(__FILE__). "/" . $dbParameters->_dbEngine . "/service_" . $dbParameters->_dbEngine . ".php");
  51              $classname = "service_" . $dbParameters->_dbEngine;
  52          }
  53  
  54          if (!class_exists($classname)) {
  55              return PEAR::raiseError("Cannot instanciate class $classname", null, null, null, null, null, false);
  56          }
  57  
  58          $obj = &new $classname;
  59          $result = $obj->setDbParameters($dbParameters);
  60  
  61          if ($dbOptions != null) {
  62              $obj->setDbOptions($dbOptions);
  63          }
  64  
  65          if (PEAR::isError($result)) {
  66              return $result;
  67          }
  68          else {
  69              return $obj;
  70          }
  71      }
  72  
  73      // }}}
  74  
  75      // {{{ constructor
  76  
  77      /**
  78       * service constructor.
  79       *
  80       * @access public
  81       */
  82  
  83  	function service () { }
  84  
  85      // }}}
  86  
  87      // {{{ getLock($nom, $timeout = 0)
  88  
  89      /**
  90       * unlock AGORA.
  91       *
  92       *
  93       * @return  mixed   boolean or PEAR::Error object
  94       * @param $nom
  95       * @param $timeout
  96       * @access public
  97       */
  98  
  99  	function getLock ($nom, $timeout = 0) {
 100          return PEAR::raiseError("[" . get_class($this). " service : getLock()] PAS D'IMPLEMENTAION DE CETTE METHODE", null, null, null, null, null, false);
 101      }
 102  
 103      // }}}
 104  
 105      // {{{ releaseLock($nom)
 106  
 107      /**
 108       * unlock AGORA.
 109       *
 110       *
 111       * @return  mixed   void or PEAR::Error object
 112       * @param $nom
 113       * @access public
 114       */
 115  
 116  	function releaseLock ($nom) {
 117          return PEAR::raiseError("[" . get_class($this). " service : releaseLock()] PAS D'IMPLEMENTAION DE CETTE METHODE", null, null, null, null, null, false);
 118      }
 119  
 120  // }}}
 121  
 122  }
 123  ?>


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