Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Echo query before execution and without execution in codeigniter Active Record

Tags:

I am looking for a way to see generated string of the query but without executing it.

Note that the query hasn't been executed before. (I do not want $this->db->last_query();)

I hope there be a method with a name like $this->db->echo_query_string($table_name = ''); to be used exactly like $this->db->get($table_name = ''); BUT THE ONLY DIFFERENCE BE THAT get() executes the code, but echo_query_string() just echoes the string of query without execution.

like image 468
Mohammad Naji Avatar asked Jan 25 '12 20:01

Mohammad Naji


1 Answers

You can see the compiled query by either of these functions

/* SELECT */ $this->db->_compile_select(); /* INSERT */ $this->db->_insert(); /* UPDATE */ $this->db->_update(); 
like image 182
Stewie Avatar answered Nov 14 '22 15:11

Stewie