domain_get_primary_table

Versions
domain
domain_get_primary_table($table)

Escape the names of the default tables for variable lookups.

There are a few cases where we must directly query data from the primary site's database. Due to table prefixing and Domain Prefix, we must ensure that we are querying the correct table.

When using this function, you should insert the $table result directly into your query string, or use token replacement '%s' syntax. Do not enclose the table name in brackets {}, as that defeats the purpose of this function.

See also

_domain_conf_load_primary()

Parameters

$table The name of the base table to lookup.

Return value

A query-safe table name pointing to the primary domain.

▾ 4 functions call domain_get_primary_table()

domain_conf_domain_bootstrap_full in domain_conf/domain_conf.module
Implementats hook_domain_bootstrap_full().
_domain_bootstrap in ./domain.bootstrap.inc
Calls individual bootstrap phases.
_domain_bootstrap_modules_get in ./domain.bootstrap.inc
Retrieves the value of the variable 'domain_bootstrap_modules' from the {variable} table. This function does not use Drupal's variable system.
_domain_conf_load_primary in domain_conf/domain_conf.module
Load the variables from the primary domain.

Code

./domain.bootstrap.inc, line 231

<?php
function domain_get_primary_table($table) {
  global $db_prefix;
  if (is_string($db_prefix)) {
    $table = $db_prefix . $table;
  }
  else if (is_array($db_prefix)) {
    $table = $db_prefix['default'] . $table;
  }
  return db_escape_table($table);
}
?>

Contact

  • agentrickard [at] gmail [dot] com

Donations

My Amazon.com Wish List