扩展PDO和PDOStatement类以支持开发统计

该包的规范仓库似乎已消失,因此该包已被冻结。

v1.0.0 2013-07-07 22:47 UTC

This package is not auto-updated.

Last update: 2020-01-10 15:00:58 UTC


README

A PDO wrapper to provide developer related information. Currently only has enough support for my current uses. Advisable only to use when in development mode, and to swap out with native PDO later.

功能

  • 提供查询计数
  • 提供查询日志(完整查询字符串,绑定参数已替换)

安装

添加到您的composer.json文件中

{
	"require": {
		"centralapps/pdo": "dev-master"
	}
}

通过composer安装

php composer.phar install

使用方法

用作PDO类的替代

$pdo = new \CentralApps\Pdo\Pdo(....

获取查询计数

echo 'There were ' . $pdo->getQueryCount() . ' queries executed on this page load';

获取查询日志

echo '<h2>Query log</h2>';
foreach ($pdo->getQueryLog() as $log) {
	echo '<p>' . $log . '</p>';
}