domain_prefix_table_exists

Definition

domain_prefix_table_exists($prefix, $table)
domain_prefix/domain_prefix.module, line 455

Description

Does a table exist -- we use this to bypass Drupal's default table prefixing check.

Parameters

$prefix The table prefix used with this domain. Optional.

$table The name of the table being acted upon.

Code

function domain_prefix_table_exists($prefix, $table) {
  global $db_type;
  $string = db_escape_table($prefix . $table);
  switch ($db_type) {
    case 'pgsql':
      $query = "SELECT table_name FROM information_schema.tables WHERE table_schema = 'public' AND table_name = '{%s}'";
      break;
    default:
      $query = "SHOW TABLES LIKE '{%s}'";
      break;
  }
  return db_num_rows(db_query($query, $string));
}