global $active_db

You are here

Active database connection.

See also

db_set_active()

File

developer/globals.php, line 122
These are the global variables that Drupal uses.

Code

global $active_db;

Comments

As implied by the see also, this is set in db_set_active, it is usually left implied by the db functions, however there are occasions when this needs to be remembered, such as if running multiple db connections, remember which one is your active (although I imagine you could switch active for interesting results, for example, based on trigger switch between databases of two drupal installations). More common is for certain special database functions you may need to use the PHP DB functions directly. One particular occasion I had to utilize a stored procedure and in that case it is useful to use mysqli functions directly in conjunction w/ the $active_db variable