function DatabaseConnection::escapeAlias

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

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];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.