Mysql_r2.diff

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

Download (1.1 kB)

 
system/libraries/drivers/Database/Mysql.php (working copy)
123 123
		if (!$this->db_config['escape'])
124 124
			return $column;
125 125

  
126
		if (strtolower($column) == 'count(*)' OR $column == '*')
126
		if ($column == '*')
127 127
			return $column;
128 128

  
129
		// This matches any functions we support to SELECT.
130
		if ( preg_match('/(avg|count|sum|max|min)\(\s*(.*)\s*\)(\s*as\s*(.+)?)?/i', $column, $matches))
131
		{
132
			if ( count($matches) == 3)
133
			{
134
				return $matches[1] . '(' . $this->escape_column($matches[2]) . ')';
135
			}
136
			else if ( count($matches) == 5)
137
			{
138
				return $matches[1] . '(' . $this->escape_column($matches[2]) . ') AS ' . $this->escape_column($matches[2]);
139
			}
140
		}
141
		
129 142
		// This matches any modifiers we support to SELECT.
130 143
		if ( ! preg_match('/\b(?:rand|all|distinct(?:row)?|high_priority|sql_(?:small_result|b(?:ig_result|uffer_result)|no_cache|ca(?:che|lc_found_rows)))\s/i', $column))
131 144
		{