final public static function Database::renameConnection
final public static Database::renameConnection($old_key, $new_key)
Rename a connection and its corresponding connection information.
Parameters
$old_key: The old connection key.
$new_key: The new connection key.
Return value
TRUE in case of success, FALSE otherwise.
File
- includes/database/database.inc, line 1649
- Core systems for the database layer.
Class
- Database
- Primary front-controller for the database system.
Code
final public static function renameConnection($old_key, $new_key) { if (empty(self::$databaseInfo)) { self::parseConnectionInfo(); } if (!empty(self::$databaseInfo[$old_key]) && empty(self::$databaseInfo[$new_key])) { // Migrate the database connection information. self::$databaseInfo[$new_key] = self::$databaseInfo[$old_key]; unset(self::$databaseInfo[$old_key]); // Migrate over the DatabaseConnection object if it exists. if (isset(self::$connections[$old_key])) { self::$connections[$new_key] = self::$connections[$old_key]; unset(self::$connections[$old_key]); } return TRUE; } else { return FALSE; } }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/includes!database!database.inc/function/Database::renameConnection/7.x