Error message

You are browsing documentation for drupal 7.x, which is not supported anymore. Read the updated version of this page for drupal 11.x (the latest version).

function DatabaseConnection::escapeField

Escapes a field name string.

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

Return value

string The sanitized field name string.

1 call to DatabaseConnection::escapeField()
DatabaseConnection_mysql::escapeField in includes/database/mysql/database.inc
Escapes a field name string.
1 method overrides DatabaseConnection::escapeField()
DatabaseConnection_mysql::escapeField in includes/database/mysql/database.inc
Escapes a field name string.

File

includes/database/database.inc, line 1003

Class

DatabaseConnection
Base Database API class.

Code

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

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