Pdosqlite_r2.diff

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

Download (1.1 kB)

 
system/libraries/drivers/Database/Pdosqlite.php (working copy)
92 92
		if ( ! $this->db_config['escape'])
93 93
			return $column;
94 94

  
95
		if (strtolower($column) == 'count(*)' OR $column == '*')
95
		if ($column == '*')
96 96
			return $column;
97 97

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

  
98 111
		// This matches any modifiers we support to SELECT.
99 112
		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))
100 113
		{