public function escapeIdentifiers($item)
	{
		if ($this->escapeChar === '' || empty($item) || in_array($item, $this->reservedIdentifiers))
		{
			return $item;
		}
		elseif (is_array($item))
		{
			foreach ($item as $key => $value)
			{
				$item[$key] = $this->escapeIdentifiers($value);
			}

			return $item;
		}
		// Avoid breaking functions and literal values inside queries
		elseif (ctype_digit($item) || $item[0] === "'" || ( $this->escapeChar !== '"' && $item[0] === '"') ||
				strpos($item, '(') !== false
		)
		{
			return $item;
		}

		static $preg_ec = [];

		if (empty($preg_ec))
		{
			if (is_array($this->escapeChar))
			{
				$preg_ec = [
					preg_quote($this->escapeChar[0], '/'),
					preg_quote($this->escapeChar[1], '/'),
					$this->escapeChar[0],
					$this->escapeChar[1],
				];
			}
			else
			{
				$preg_ec[0] = $preg_ec[1] = preg_quote($this->escapeChar, '/');
				$preg_ec[2] = $preg_ec[3] = $this->escapeChar;
			}
		}

		foreach ($this->reservedIdentifiers as $id)
		{
			if (strpos($item, '.' . $id) !== false)
			{
				return preg_replace('/' . $preg_ec[0] . '?([^' . $preg_ec[1] . '\.]+)' . $preg_ec[1] . '?\./i', $preg_ec[2] . '$1' . $preg_ec[3] . '.', $item);
			}
		}

		return preg_replace('/' . $preg_ec[0] . '?([^' . $preg_ec[1] . '\.]+)' . $preg_ec[1] . '?(\.)?/i', $preg_ec[2] . '$1' . $preg_ec[3] . '$2', $item);
	}
public function escapeIdentifiers($item)
	{
		if ($this->escapeChar === '' || empty($item) || in_array($item, $this->reservedIdentifiers))
		{
			return $item;
		}
		elseif (is_array($item))
		{
			foreach ($item as $key => $value)
			{
				$item[$key] = $this->escapeIdentifiers($value);
			}

			return $item;
		}
		// Avoid breaking functions and literal values inside queries
		elseif (ctype_digit($item) || $item[0] === "'" || ( $this->escapeChar !== '"' && $item[0] === '"') ||
				strpos($item, '(') !== false
		)
		{
			return $item;
		}

		static $preg_ec = [];

		if (empty($preg_ec))
		{
			if (is_array($this->escapeChar))
			{
				$preg_ec = [
					preg_quote($this->escapeChar[0], '/'),
					preg_quote($this->escapeChar[1], '/'),
					$this->escapeChar[0],
					$this->escapeChar[1],
				];
			}
			else
			{
				$preg_ec[0] = $preg_ec[1] = preg_quote($this->escapeChar, '/');
				$preg_ec[2] = $preg_ec[3] = $this->escapeChar;
			}
		}

		foreach ($this->reservedIdentifiers as $id)
		{
			if (strpos($item, '.' . $id) !== false)
			{
				return preg_replace('/' . $preg_ec[0] . '?([^' . $preg_ec[1] . '\.]+)' . $preg_ec[1] . '?\./i', $preg_ec[2] . '$1' . $preg_ec[3] . '.', $item);
			}
		}

		return preg_replace('/' . $preg_ec[0] . '?([^' . $preg_ec[1] . '\.]+)' . $preg_ec[1] . '?(\.)?/i', $preg_ec[2] . '$1' . $preg_ec[3] . '$2', $item);
	}
public function escapeIdentifiers ( $ item ) { if ( $ this -> escapeChar === '' || empty ( $ item ) || in_array ( $ item , $ this -> reservedIdentifiers ) ) { return $ item ; } elseif ( is_array ( $ item ) ) { foreach ( $ item as $ key => $ value ) { $ item [ $ key ] = $ this -> escapeIdentifiers ( $ value ) ; } return $ item ; } // Avoid breaking functions and literal values inside queries elseif ( ctype_digit ( $ item ) || $ item [ 0 ] === "'" || ( $ this -> escapeChar !== '"' && $ item [ 0 ] === '"' ) || strpos ( $ item , '(' ) !== false ) { return $ item ; } static $ preg_ec = [ ] ; if ( empty ( $ preg_ec ) ) { if ( is_array ( $ this -> escapeChar ) ) { $ preg_ec = [ preg_quote ( $ this -> escapeChar [ 0 ] , '/' ) , preg_quote ( $ this -> escapeChar [ 1 ] , '/' ) , $ this -> escapeChar [ 0 ] , $ this -> escapeChar [ 1 ] , ] ; } else { $ preg_ec [ 0 ] = $ preg_ec [ 1 ] = preg_quote ( $ this -> escapeChar , '/' ) ; $ preg_ec [ 2 ] = $ preg_ec [ 3 ] = $ this -> escapeChar ; } } foreach ( $ this -> reservedIdentifiers as $ id ) { if ( strpos ( $ item , '.' . $ id ) !== false ) { return preg_replace ( '/' . $ preg_ec [ 0 ] . '?([^' . $ preg_ec [ 1 ] . '\.]+)' . $ preg_ec [ 1 ] . '?\./i' , $ preg_ec [ 2 ] . '$1' . $ preg_ec [ 3 ] . '.' , $ item ) ; } } return preg_replace ( '/' . $ preg_ec [ 0 ] . '?([^' . $ preg_ec [ 1 ] . '\.]+)' . $ preg_ec [ 1 ] . '?(\.)?/i' , $ preg_ec [ 2 ] . '$1' . $ preg_ec [ 3 ] . '$2' , $ item ) ; }
Escape the SQL Identifiers

This function escapes column and table names

@param mixed $item

@return mixed
Escape the SQL Identifiers