[ 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/ -> parameters.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  // Class for defining data source connection parameters
  20  //
  21  if (defined("_BD_PARAMS"))
  22      return;
  23  
  24  define("_BD_PARAMS", "1");
  25  
  26  /**
  27   * This class defines parameters for accessing a given datasource
  28   * @package    BD
  29   * @author  Antoine Angénieux <aangenieux@clever-age.com>
  30   * @author     Erwan Le Bescond <elebescond@clever-age.com>
  31   * @access    public
  32   */
  33  
  34  class BD_parameters {
  35  
  36      // {{{ properties
  37  
  38      /**
  39       * DB engine normalized name (see PEAR::DB for more information)
  40       * @var     String
  41       * @access  private
  42       */
  43      var $_dbEngine;
  44  
  45      /**
  46       * User name for database connection
  47       * @var     String
  48       * @access  private
  49       */
  50      var $_dbUser;
  51  
  52      /**
  53       * User password for database connection
  54       * @var     String
  55       * @access  private
  56       */
  57      var $_dbPass;
  58  
  59      /**
  60       * DB engine host name
  61       * @var     String
  62       * @access  private
  63       */
  64      var $_dbHost;
  65  
  66      /**
  67       * Database name
  68       * @var     String
  69       * @access  private
  70       */
  71      var $_dbName;
  72  
  73      // }}}
  74  
  75      // {{{ getDbEngine()
  76  
  77      /**
  78       * Getter method to retreive Engine var
  79       *
  80       * @return      Engine var
  81       * @access      public
  82       */
  83  
  84  	function getDbEngine () {
  85          return $this->_dbEngine;
  86      }
  87  
  88      // }}}
  89  
  90      // {{{ setDbEngine()
  91  
  92      /**
  93       * Setter method to set Engine var
  94       *
  95       * @param $dbEngine     new DB Engine
  96       */
  97  
  98  	function setDbEngine ($dbEngine) {
  99          $this->_dbEngine = $dbEngine;
 100      }
 101  
 102      // }}}
 103  
 104      // {{{ getDbUser()
 105  
 106      /**
 107       * Getter method to retreive User var
 108       *
 109       * @return      User var
 110       * @access      public
 111       */
 112  
 113  	function getDbUser () {
 114          return $this->_dbUser;
 115      }
 116  
 117      // }}}
 118  
 119      // {{{ setDbUser()
 120  
 121      /**
 122       * Setter method to set User var
 123       *
 124       * @param $dbUser     new DB User
 125       */
 126  
 127  	function setDbUser ($dbUser) {
 128          $this->_dbUser = $dbUser;
 129      }
 130  
 131      // }}}
 132  
 133      // {{{ getDbPass()
 134  
 135      /**
 136       * Getter method to retreive Pass var
 137       *
 138       * @return      Pass var
 139       * @access      public
 140       */
 141  
 142  	function getDbPass () {
 143          return $this->_dbPass;
 144      }
 145  
 146      // }}}
 147  
 148      // {{{ setDbPass()
 149  
 150      /**
 151       * Setter method to set Pass var
 152       *
 153       * @param $dbPass     new DB Engine
 154       */
 155  
 156  	function setDbPass ($dbPass) {
 157          $this->_dbPass = $dbPass;
 158      }
 159  
 160      // }}}
 161  
 162      // {{{ getDbHost()
 163  
 164      /**
 165       * Getter method to retreive Host var
 166       *
 167       * @return      Host var
 168       * @access      public
 169       */
 170  
 171  	function getDbHost () {
 172          return $this->_dbHost;
 173      }
 174  
 175      // }}}
 176  
 177      // {{{ setDbHost()
 178  
 179      /**
 180       * Setter method to set Host var
 181       *
 182       * @param $dbHost     new DB Host
 183       */
 184  
 185  	function setDbHost ($dbHost) {
 186          $this->_dbHost = $dbHost;
 187      }
 188  
 189      // }}}
 190  
 191      // {{{ getDbName()
 192  
 193      /**
 194       * Getter method to retreive Name var
 195       *
 196       * @return      Name var
 197       * @access      public
 198       */
 199  
 200  	function getDbName () {
 201          return $this->_dbName;
 202      }
 203  
 204      // }}}
 205  
 206      // {{{ setDbName()
 207  
 208      /**
 209       * Setter method to set Name var
 210       *
 211       * @param $dbEngine     new DB Name
 212       */
 213  
 214  	function setDbName ($dbName) {
 215          $this->_dbName = $dbName;
 216      }
 217  
 218      // }}}
 219  
 220      // {{{ constructor
 221  
 222      /**
 223       * Constructor for BD_Paramaters class
 224       * @param   $dbEngine String representing the normalized DB engine name
 225       * @param   $dbUser String representing the db user
 226       * @param   $dbPass String representing the user password
 227       * @param   $dbHost String representing the DB host
 228       * @param   $dbName String representing the DB name
 229       * @access  public
 230       */
 231  	function BD_parameters ($dbEngine, $dbUser, $dbPass, $dbHost, $dbName) {
 232          $this->_dbEngine = $dbEngine;
 233          $this->_dbUser = $dbUser;
 234          $this->_dbPass = $dbPass;
 235          $this->_dbHost = $dbHost;
 236          $this->_dbName = $dbName;
 237      }
 238  
 239      // }}}
 240  
 241      // {{{ getDSN()
 242  
 243      /**
 244       * This method returns the PEAR::DB well formed DSN
 245       * @return  String representing the PEAR::DB DSB
 246       * @access public
 247       */
 248  	function getDSN () {
 249          $datasource
 250              = $this->_dbEngine . '://' . $this->_dbUser . ':' . $this->_dbPass . '@' . $this->_dbHost . '/' . $this->_dbName;
 251          return $datasource;
 252      }
 253  
 254  // }}}
 255  }
 256  ?>


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