private function wrap($value) {

		if (strpos(strtolower($value), 'null') !== false) {
			return $value;
		}

		// If the value being wrapped has a column alias we will need to separate out
		// the pieces so we can wrap each of the segments of the expression on it
		// own, and then joins them both back together with the "as" connector.
		if (strpos(strtolower($value), ' as ') !== false) {
			$segments = explode(' ', $value);

			return $this->wrap($segments[0]).' as '.$this->wrapValue($segments[2]);
		}
	
		$wrapped = array();
	
		$segments = explode('.', $value);
	
		// If the value is not an aliased table expression, we'll just wrap it like
		// normal, so if there is more than one segment, we will wrap the first
		// segments as if it was a table and the rest as just regular values.
		foreach ($segments as $key => $segment) {
			$wrapped[] = $this->wrapValue($segment);
		}
	
		return implode('.', $wrapped);
	}