执行前回显查询,而未在Codeigniter Active Record中执行 [英] Echo query before execution and without execution in codeigniter Active Record

查看:57
本文介绍了执行前回显查询,而未在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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆