开发者

How to count the number of queries with DBIx::Class?

I'm using DBIx::Class in a web context and I'd like to display the number of SQL querie开发者_开发百科s performed and the time they took for the rendering of a page.

Any idea about how to implement that?


See the DBIx::Class cookbook on the "Profiling" section for examples on how to do that.

Simply enabling profiling via the DBIC_TRACE=1 environment variable will not do what you want, but you can sub-class DBIx::Class::Storage::Statistics (as per the linked cookbook example) and override query_start and query_end in a way that lets you count the SQL queries done.

The linked example is very close to what you want to achieve.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜