[eluser]a&w[/eluser]
Seems the behavior is more widespread than I thought.
User guide has:
Quote:Protecting identifiers
In many databases it is advisable to protect table and field names - for example with backticks in MySQL. Active Record queries are automatically protected, however if you need to manually protect an identifier you can use:
$this->db->protect_identifiers('table_name');
Seems the above is also affected by whatever was last set. So if you use:
Code:
$this->db->select($select, false);
Than all subsequent $this->db->from() also will use whatever that boolean was set as.
While the user guide suggests you can set protect identifier explicitly, I don't see that to be the case as:
Code:
function protect_identifiers($item, $prefix_single = FALSE)
{
return $this->_protect_identifiers($item, $prefix_single);
}
Note, no 3rd argument!!!
So when you get here, the 3rd argument is null and whatever the last setting was is used.
Code:
function _protect_identifiers($item, $prefix_single = FALSE, $protect_identifiers = NULL, $field_exists = TRUE)
{
if ( ! is_bool($protect_identifiers))
{
$protect_identifiers = $this->_protect_identifiers;
}
Solution?? Just allow a 3rd argument?
Code:
function protect_identifiers($item, $prefix_single = FALSE, $protect_identifiers = NULL)
{
return $this->_protect_identifiers($item, $prefix_single, $protect_identifiers);
}