You are here

function dba_invoke_driver_specific in Database Administration 7

Helper function to invoke driver specific functionality.

5 calls to dba_invoke_driver_specific()
dba_describe_table in ./dba.admin.inc
DESCRIBE table. FIXME: The tableselect is broken.
dba_report_page in ./dba.report.inc
Display database report.
dba_show_create_table in ./dba.admin.inc
We can't use drupal_get_schema() as we want what is really in the database.
dba_statpack_batch_snapshot in ./dba.statpack.inc
dba_statpack_page in ./dba.statpack.inc
Display database report.

File

./dba.module, line 110
Directly administer your Drupal website.

Code

function dba_invoke_driver_specific($function, $arg, $file = '') {
  static $drivers;
  $driver = db_driver();
  if (!isset($drivers[$driver][$file])) {
    $drivers[$driver][$file] = TRUE;
    if (!empty($file)) {
      $filename = "{$driver}.{$file}.inc";
    }
    else {
      $filename = "{$driver}.inc";
    }
    $driver_inc = DRUPAL_ROOT . '/' . drupal_get_path('module', 'dba') . "/database/{$filename}";
    if (file_exists($driver_inc)) {
      require_once $driver_inc;
    }
    else {
      drupal_set_message(t('Incomplete implementation for %driver database driver, %function is not defined in %file.', array(
        '%driver' => $driver,
        '%function' => $function . '()',
        '%file' => "dba/database/{$driver}.inc",
      )), 'error');
      $drivers[$driver] = FALSE;
    }
  }
  if (!empty($file)) {
    $function = "dba_{$driver}_{$file}_{$function}";
  }
  else {
    $function = "dba_{$driver}_{$function}";
  }
  if (function_exists($function)) {
    return $function($arg);
  }
  else {
    drupal_set_message(t('Incomplete implementation for %driver database driver, %function is not defined in %file.', array(
      '%driver' => $driver,
      '%function' => $function . '()',
      '%file' => "dba/database/{$driver}.inc",
    )), 'error');
  }
}