public function DatabaseConnection_sqlsrv::escapeField in Drupal driver for SQL Server and SQL Azure 7
Same name and namespace in other branches
- 7.3 sqlsrv/database.inc \DatabaseConnection_sqlsrv::escapeField()
- 7.2 sqlsrv/database.inc \DatabaseConnection_sqlsrv::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.
Overrides DatabaseConnection::escapeField
File
- sqlsrv/
database.inc, line 191 - Database interface code for Microsoft SQL Server.
Class
Code
public function escapeField($field) {
if (strlen($field) > 0) {
return implode('.', array_map(array(
$this,
'quoteIdentifier',
), explode('.', preg_replace('/[^A-Za-z0-9_.]+/', '', $field))));
}
else {
return '';
}
}