在执行前和未在 codeigniter Active Record 中执行时回显查询 [英] Echo query before execution and without execution in codeigniter Active Record
问题描述
我正在寻找一种方法来查看生成的查询字符串,但不执行它.
I am looking for a way to see generated string of the query but without executing it.
请注意,该查询之前未执行过.(我不想要 $this->db->last_query();
)
Note that the query hasn't been executed before. (I do not want $this->db->last_query();
)
我希望有一个像 $this->db->echo_query_string($table_name = '');
这样名字的方法被使用完全像$this->db->get($table_name = '');
但唯一的区别是 get()
执行代码,但 echo_query_string()
只是回显查询字符串不执行.
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.
推荐答案
您可以通过这两个函数中的任何一个查看编译后的查询
You can see the compiled query by either of these functions
/* SELECT */ $this->db->_compile_select();
/* INSERT */ $this->db->_insert();
/* UPDATE */ $this->db->_update();
这篇关于在执行前和未在 codeigniter Active Record 中执行时回显查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!