You are here

public function DatabaseConnection::escapeTable in Drupal 7

Escapes a table name string.

Force all table names to be strictly alphanumeric-plus-underscore. For some database drivers, it may also wrap the table name in database-specific escape characters.

Return value

string The sanitized table name string.

File

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

Class

DatabaseConnection
Base Database API class.

Code

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