![]() |
$this->_protect_identifiers not affected by $this->db->flush_cache(); - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: $this->_protect_identifiers not affected by $this->db->flush_cache(); (/showthread.php?tid=14555) |
$this->_protect_identifiers not affected by $this->db->flush_cache(); - El Forum - 01-06-2009 [eluser]a&w[/eluser] Perhaps this might be more unexpected behavior than outright bug. If you flush the cache the _protect_identifiers setting remains whatever was last set, unless you explicitly pass the "$escape" parameter. I'd suggest either some fix or at least a caution in the user guide that if you're using that 2nd parameter at all, that you should probably use it for all select statements of that query, otherwise it uses the last entry (not the default of TRUE any longer. Code: /** Instead of: Code: function select($select = '*', $escape = NULL) Code: function select($select = '*', $escape = TRUE) Seems like it starts off as true, so why wouldn't that be the default instead of using the last setting it was passed? That or seems like it should respect the flush cache request. $this->_protect_identifiers not affected by $this->db->flush_cache(); - El Forum - 01-06-2009 [eluser]a&w[/eluser] Seems the behavior is more widespread than I thought. User guide has: Quote:Protecting identifiers 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) 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) Solution?? Just allow a 3rd argument? Code: function protect_identifiers($item, $prefix_single = FALSE, $protect_identifiers = NULL) |