1 database.inc public DatabaseConnection::escapeAlias($field)

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.

Parameters

string $field: The field alias to be escaped.

Return value

string: The sanitized field alias string.

File

core/includes/database/database.inc, line 1043
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];
}