[英]Count number of queries performed by Doctrine
I am using Doctrine and sometimes I've the feeling that it is doing much more things than what I am expecting, so I would like to have more information (and therefore more control) about what Doctrine is doing. 我正在使用Doctrine,有时我觉得它做的事情比我期望的要多得多,所以我希望得到更多关于Doctrine正在做什么的信息(因此更多的控制)。
So, how I could count the total number of queries that Doctrine is doing?. 那么,我如何计算Doctrine正在进行的查询总数? It would be nice if I could also find the SQL statements that Doctrine is performing implicitly, (apart of the ones that I am creating).
如果我还能找到Doctrine隐式执行的SQL语句(除了我正在创建的那些语句),那将是很好的。
Thank you in advance! 先感谢您!
I suggest this wonderful article: 我建议这篇精彩的文章:
http://www.phpandstuff.com/articles/codeigniter-doctrine-scratch-day-8-hooks-profiling-dql
http://www.phpandstuff.com/articles/codeigniter-doctrine-scratch-day-8-hooks-profiling-dql
Find the section that's headed " Profiling with Doctrine " This is specific for the use with a framework but you should figure out how to do it without the framework, it's not hard 找到标题为“ 使用Doctrine进行概要分析 ”的部分这是特定于框架的使用,但你应该弄清楚如何在没有框架的情况下进行,这并不困难
Doctrine has a Profiler components, that allows one to keep track of every access that's done to the database. Doctrine有一个Profiler组件,允许用户跟踪对数据库所做的每次访问。
Note, though, that the profiler could get you much more informations that you expect : depending on how you configure it, it'll indicate each time some data is fetched from the DB as an event (even if it doesn't mean a query is performed each time) . 但请注意,探查器可以为您提供更多您期望的信息:根据您的配置方式,它会指示每次从数据库中提取某些数据作为事件(即使它不代表查询每次执行) 。
Also; 也; as Doctrine is using prepared statements, you'll never be able to see any "real" SQL query : you'll only see statements, and the corresponding data.
由于Doctrine正在使用预处理语句,您将永远无法看到任何“真正的”SQL查询:您只会看到语句和相应的数据。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.