v9教你输出最后一次sql语句
2015-09-24 15:25
253 查看
mysql.class.php 位于phpcms/libs/classes
在public $lastqueryid = null;后面加入代码
public $lastquerysql = null; //最后一次查询sql
复制代码
修改execute方法
private function execute($sql) {
if(!is_resource($this->link)) {
$this->connect();
}
$this->lastqueryid = mysql_query($sql, $this->link) or $this->halt(mysql_error(), $sql);
$this->querycount++;
$this->lastquerysql = $sql;//赋值最后的sql语句
return $this->lastqueryid;
}
复制代码
怎么调用?
在项目中
$sql=$this->db->lastquerysql; echo $sql;适合调试用。
记得上次测试好像无效果。不过我自己加代码可以显示了。今天都忘记是怎么改的了。留存备查。
在public $lastqueryid = null;后面加入代码
public $lastquerysql = null; //最后一次查询sql
复制代码
修改execute方法
private function execute($sql) {
if(!is_resource($this->link)) {
$this->connect();
}
$this->lastqueryid = mysql_query($sql, $this->link) or $this->halt(mysql_error(), $sql);
$this->querycount++;
$this->lastquerysql = $sql;//赋值最后的sql语句
return $this->lastqueryid;
}
复制代码
怎么调用?
在项目中
$sql=$this->db->lastquerysql; echo $sql;适合调试用。
记得上次测试好像无效果。不过我自己加代码可以显示了。今天都忘记是怎么改的了。留存备查。
相关文章推荐
- Redis 命令 - Keys
- mysql主主+keepalived高并发高负载情况测试数据一致性问题
- MySQL 中 INSERT 的一般用法
- sql优化
- Oracle中如何使用REGEXP_SUBSTR,listagg函数
- sql语句中----删除表数据drop、truncate和delete的用法
- Spark SQL中的DataFrame
- sqlite编码问题
- SQL2008 MSSQLSERVER服务无法启动,报错"17051"怎么解决
- mysql 事务处理
- Oracle OCCI学习之开篇
- SQL 删除重复记录,并保留其中一条
- SqlDataAdapter.FillSchema(DataTable)方法填充数据表的主键和约束
- loadrunner链接mysql数据库
- 如何在Excel中快速组成SQL
- memcached 学习
- C#操作sqlite数据库使用SQLiteParameter传递参数
- sqlite3: tool for sqlite
- C#操作sqlite数据库使用SQLiteParameter传递参数
- mysql cache使用