[ Index ]

PHP Cross Reference of Joomla 2.5.4 DE

title

Body

[close]

/installation/helpers/ -> database.php (source)

   1  <?php
   2  /**
   3   * @package        Joomla.Installation
   4   * @copyright    Copyright (C) 2005 - 2012 Open Source Matters. All rights reserved.
   5   * @license        GNU General Public License version 2 or later; see LICENSE.txt
   6   */
   7  
   8  /**
   9   * Joomla Installation Database Helper Class.
  10   *
  11   * @static
  12   * @package        Joomla.Installation
  13   * @since        1.6
  14   */
  15  class JInstallationHelperDatabase
  16  {
  17      /**
  18       * Method to get a JDatabase object.
  19       *
  20       * @param    string    $driver        The database driver to use.
  21       * @param    string    $host        The hostname to connect on.
  22       * @param    string    $user        The user name to connect with.
  23       * @param    string    $password    The password to use for connection authentication.
  24       * @param    string    $database    The database to use.
  25       * @param    string    $prefix        The table prefix to use.
  26       * @param    boolean $select        True if the database should be selected.
  27       *
  28       * @return    JDatabase
  29       * @since    1.0
  30       */
  31      public static function & getDBO($driver, $host, $user, $password, $database, $prefix, $select = true)
  32      {
  33          static $db;
  34  
  35          if (!$db) {
  36              // Build the connection options array.
  37              $options = array (
  38                  'driver' => $driver,
  39                  'host' => $host,
  40                  'user' => $user,
  41                  'password' => $password,
  42                  'database' => $database,
  43                  'prefix' => $prefix,
  44                  'select' => $select
  45              );
  46  
  47              // Get a database object.
  48              $db = JDatabase::getInstance($options);
  49          }
  50  
  51          return $db;
  52      }
  53  }


Generated: Tue Apr 3 11:40:28 2012 Cross-referenced by PHPXref 0.7.1