antonmarin/traceable-pdo

This package is abandoned and no longer maintained. No replacement package was suggested.

Wrapper for PDO that adds trace of statement source to analyze slow SQL statements in real-time

2.1.0 2019-12-31 04:26 UTC

This package is auto-updated.

Last update: 2024-01-29 01:19:22 UTC


README

Adds trace to your sql statement

Build Status Latest Stable Version License

Code Climate Test Coverage Total Downloads

Usage

When you use traceablePDO\PDO your statement looks like SELECT 1 /* eJxT0NdSKM7PTVUoKUpMTlUoLinKzEtX0NIHAF05B60= */ so to get trace you should just enter in your terminal php -r 'echo gzuncompress(base64_decode("eJxT0NdSKM7PTVUoKUpMTlUoLinKzEtX0NIHAF05B60="));'

Examples

Yii2

config/main.php

...
    'db' => [
        'class' => yii\db\Connection::class,
        'dsn' => 'mysql:host=localhost;dbname=stay2',
        'username' => 'root',
        'password' => 'pass',
        'charset' => 'utf8',
        'pdoClass' => antonmarin\TraceablePDO\PDO::class, // this line adds traces
    ],
...