final public static function Database::getConnection

cis7 database.inc final public static Database::getConnection($target = 'default', $key = NULL)
cle7 database.inc final public static Database::getConnection($target = 'default', $key = NULL)
elmsmedia7 database.inc final public static Database::getConnection($target = 'default', $key = NULL)
icor7 database.inc final public static Database::getConnection($target = 'default', $key = NULL)
meedjum_blog7 database.inc final public static Database::getConnection($target = 'default', $key = NULL)
mooc7 database.inc final public static Database::getConnection($target = 'default', $key = NULL)

Gets the connection object for the specified database key and target.

Parameters

$target: The database target name.

$key: The database connection key. Defaults to NULL which means the active key.

Return value

DatabaseConnection The corresponding connection object.

73 calls to Database::getConnection()
advagg_bundler_analysis in sites/all/modules/ulmus/advagg/advagg_bundler/advagg_bundler.module
Given a filename return a bundle key.
backup_migrate_destination_db::_get_db_connection in sites/all/modules/ulmus/backup_migrate/includes/destinations.db.inc
Get the db connection for the specified db.
DatabaseTasks::checkEngineVersion in includes/install.inc
Check the engine version.
DatabaseTasks::connect in includes/install.inc
Check if we can connect to the database.
DatabaseTasks_pgsql::checkBinaryOutput in includes/database/pgsql/install.inc
Check Binary Output.

... See full list

File

includes/database/database.inc, line 1460
Core systems for the database layer.

Class

Database
Primary front-controller for the database system.

Code

final public static function getConnection($target = 'default', $key = NULL) {
  if (!isset($key)) {
    // By default, we want the active connection, set in setActiveConnection.
    $key = self::$activeKey;
  }
  // If the requested target does not exist, or if it is ignored, we fall back
  // to the default target. The target is typically either "default" or
  // "slave", indicating to use a slave SQL server if one is available. If
  // it's not available, then the default/master server is the correct server
  // to use.
  if (!empty(self::$ignoreTargets[$key][$target]) || !isset(self::$databaseInfo[$key][$target])) {
    $target = 'default';
  }

  if (!isset(self::$connections[$key][$target])) {
    // If necessary, a new connection is opened.
    self::$connections[$key][$target] = self::openConnection($key, $target);
  }
  return self::$connections[$key][$target];
}
Error | ELMSLN API

Error

×

Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/api.elmsln.org/includes/common.inc:2791) in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/api.elmsln.org/sites/all/modules/apc/drupal_apc_cache.inc).
The website encountered an unexpected error. Please try again later.