lithium\data\source\Database::name()
Overrides
lithium\data\Source::name()
Field name handler to ensure proper escaping.
Parameters
-
string
$name
Field or identifier name.
Returns
stringReturns $name
quoted according to the rules and quote characters of the
database adapter subclass.
Source
public function name($name) {
if (isset($this->_cachedNames[$name])) {
return $this->_cachedNames[$name];
}
list($open, $close) = $this->_quotes;
list($first, $second) = $this->_splitFieldname($name);
if ($first) {
$result = "{$open}{$first}{$close}.{$open}{$second}{$close}";
} elseif (preg_match('/^[a-z0-9_-]+$/iS', $name)) {
$result = "{$open}{$name}{$close}";
} else {
$result = $name;
}
return $this->_cachedNames[$name] = $result;
}