You are here

function bat_get_db_prefix in Booking and Availability Management Tools for Drupal 7

Get the default database prefix.

4 calls to bat_get_db_prefix()
BatEventController::batStoreSave in modules/bat_event/bat_event.module
Handles saving to the BatStore.
bat_event_edit_form_validate in modules/bat_event/bat_event.admin.inc
Form API validate callback for the event form.
bat_event_get_calendar in modules/bat_event/bat_event.module
Retrieves relevant units and instantiates a BAT calendar object than can be reused. It is preferred to use this function to reduce the cost of setting up a calendar (i.e. loading units).
bat_facets_search_api_query_alter in modules/bat_facets/bat_facets.module
Implements hook_search_api_query_alter().

File

./bat.module, line 739
Provides basic underlying functionality and configuration options used by all BAT modules.

Code

function bat_get_db_prefix() {
  global $databases;
  $prefix = '';
  if (!empty($databases['default']['default']['prefix'])) {
    if (is_array($databases['default']['default']['prefix'])) {
      $prefix = $databases['default']['default']['prefix']['default'];
    }
    else {
      $prefix = $databases['default']['default']['prefix'];
    }
  }
  return $prefix;
}