Skip navigation
Help

DatabaseConnection::escapeField

7 database.inc public DatabaseConnection::escapeField($field)

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

The sanitized field name string.

File

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

Code

public function escapeField($field) {
  return preg_replace('/[^A-Za-z0-9_.]+/', '', $field);
}