Pgsql_r2.diff

ambirex -, 02/06/2009 06:03 pm

Download (1 kB)

 
system/libraries/drivers/Database/Pgsql.php (working copy)
98 98
		if (!$this->db_config['escape'])
99 99
			return $column;
100 100

  
101
		if (strtolower($column) == 'count(*)' OR $column == '*')
101
		if ($column == '*')
102 102
			return $column;
103 103

  
104
		// This matches any functions we support to SELECT.
105
		if ( preg_match('/(avg|count|sum|max|min)\(\s*(.*)\s*\)(\s*as\s*(.+)?)?/i', $column, $matches))
106
		{
107
			if ( count($matches) == 3)
108
			{
109
				return $matches[1] . '(' . $this->escape_column($matches[2]) . ')';
110
			}
111
			else if ( count($matches) == 5)
112
			{
113
				return $matches[1] . '(' . $this->escape_column($matches[2]) . ') AS ' . $this->escape_column($matches[2]);
114
			}
115
		}
116

  
104 117
		// This matches any modifiers we support to SELECT.
105 118
		if ( ! preg_match('/\b(?:all|distinct)\s/i', $column))
106 119
		{