You are here

public function DatabaseConnection::escapeAlias in Drupal 7

Escapes an alias name string.

Force all alias names to be strictly alphanumeric-plus-underscore. In contrast to DatabaseConnection::escapeField() / DatabaseConnection::escapeTable(), this doesn't allow the period (".") because that is not allowed in aliases.

Return value

string The sanitized field name string.

1 call to DatabaseConnection::escapeAlias()
DatabaseConnection_mysql::escapeAlias in includes/database/mysql/database.inc
Escapes an alias name string.
1 method overrides DatabaseConnection::escapeAlias()
DatabaseConnection_mysql::escapeAlias in includes/database/mysql/database.inc
Escapes an alias name string.

File

includes/database/database.inc, line 1021
Core systems for the database layer.

Class

DatabaseConnection
Base Database API class.

Code

public function escapeAlias($field) {
  if (!isset($this->escapedAliases[$field])) {
    $this->escapedAliases[$field] = preg_replace('/[^A-Za-z0-9_]+/', '', $field);
  }
  return $this->escapedAliases[$field];
}