Active Record protect identifier quotes error |
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
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/gener...ivers.html Regards |
Welcome Guest, Not a member yet? Register Sign In |