lithium\data\source\Database::_fieldsQuote()
Quotes fields, also handles aliased fields.
Parameters
-
string
$alias
-
string
$field
Returns
stringThe quoted field.
Source
protected function _fieldsQuote($alias, $field) {
list($open, $close) = $this->_quotes;
$aliasing = preg_split("/\s+as\s+/i", $field);
if (isset($aliasing[1])) {
list($aliasname, $fieldname) = $this->_splitFieldname($aliasing[0]);
$alias = $aliasname ? : $alias;
return "{$open}{$alias}{$close}.{$open}{$fieldname}{$close} as {$aliasing[1]}";
} elseif ($alias) {
return "{$open}{$alias}{$close}.{$open}{$field}{$close}";
} else {
return "{$open}{$field}{$close}";
}
}