EllisLab/CodeIgniter — pull request #2935 by timmiedinnie (2014-03-13 14:48:01+00:00)
Title: Bugfix for protect_identifiers method

When methods with comma seperators are used in the select statement i.e. `CONCAT_WS` or `CONCAT`. These are exploded and sent partially to the protect_identifiers() method. This results in Syntax errors.

The bug fix for `MAX()`, `MIN()` etc, only work for the first part of this exploded method.

Example:
```
$this->db->select("*, CONCAT(' ',foo,bar) as foobar");
```

Becomes:
```
SELECT *, CONCAT(' ', `foo`, `bar)` as `foobar`
```

Notice the syntax error
```
`bar)`
```

Added a bugfix which fixes the last part of these kind of methods and backticks at the right place.

Result after bugfix:
```
`SELECT *, CONCAT(' ', `foo`, `bar`) as `foobar`
```