Go to file
2024-02-02 11:39:13 +01:00
example improve code style 2024-02-02 11:39:13 +01:00
img remove Query Status Monitor, complete implementation 2020-05-01 01:08:23 +02:00
src improve code style 2024-02-02 11:39:13 +01:00
.gitattributes change line endings for easy patching 2020-05-25 09:48:12 +02:00
.gitignore Initial commit 2019-08-20 23:35:53 +02:00
.php-cs-fixer.php improve code style 2024-02-02 11:39:13 +01:00
CHANGELOG.md adjust CHANGELOG 2022-09-05 14:13:51 +02:00
composer.json improve code style 2024-02-02 11:39:13 +01:00
LICENSE Initial commit 2019-08-20 23:33:18 +02:00
phpstan.neon improve code quality 2024-02-02 11:33:11 +01:00
README.md adjust documentation 2021-03-02 15:50:39 +01:00

Oxid eShop SQL Logger

Returns all SQL queries into console of a Browser.

Install

composer require --dev d3/oxid-sql-logger

Usage

Just set the function D3StartSQLLog() somewhere and from that point on all SQLs will be logged.

\D3StartSQLLog('specific log message');

$db = \OxidEsales\Eshop\Core\DatabaseProvider::getDb(\OxidEsales\Eshop\Core\DatabaseProvider::FETCH_MODE_ASSOC);
$list = $db->getAll('SELECT * FROM oxarticles WHERE oxprice < ? LIMIT 100', [49.99]);

\D3StopSQLLog();

Screenshots

Browser:

Example all sqls

CLI:

Example CLI

Configuration

Add the sections to the config.inc.php of the shop if needed:

$this->SqlLoggerGUIHandlers = [
    \Monolog\Handler\BrowserConsoleHandler::class,
    \D3\OxidSqlLogger\Handler\d3FirePHPHandler::class
];

Standard handlers are BrowserConsoleHandler and d3FirePHPHandler.

$this->SqlLoggerCLIHandlers = [
    ...
];

Standard handler is StreamHandler.

$this->d3FirePHPOptions = [
    \D3\OxidSqlLogger\Handler\d3FirePHPHandler::ADD_TRACE
];

Credits

Many thanks to Tobias Matthaiou for his inspiration.