lithium\data\source\Database::name()

public method

Field name handler to ensure proper escaping.

Parameters

  • string $name

    Field or identifier name.

Returns

string

Returns $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;
	}