![]() |
Active Record protect identifier quotes error - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: Active Record protect identifier quotes error (/showthread.php?tid=74481) |
Active Record protect identifier quotes error - Steve Galatoczki - 09-30-2019 Hi, I use the $this->db->select second parameters, to disable protect in my subquery, so the subquery string would not contain quotes. Ex: Code: $this->db->select('col1, col2, col3, col4', FALSE); But if I put my subquery into second select's 'from' function (Ex: $this->db->from('('.$subquery.')' AS Foo) ), my query string will contain quotes. I found in the from function of the query builder class, a $this->protect_identifiers function with fix third parameters (NULL). If I change the original NULL value to FALSE, the query will works properly. My solution: Code: public function from($from, $protected = NULL) My question: Is there another way to fix the error, without modifying the core code? Thanks, Steve RE: Active Record protect identifier quotes error - fernaog - 09-30-2019 Hi, You could create a driver and extend the CI_DB_query_builder class. In this way you can modify the from function to your liking without modifying the core. https://codeigniter.com/user_guide/general/creating_drivers.html Regards |