Go to file
2022-09-05 14:13:51 +02:00
example improve code 2022-08-18 14:18:43 +02:00
img remove Query Status Monitor, complete implementation 2020-05-01 01:08:23 +02:00
src fix empty default parameter argument error 2022-09-05 09:05:54 +02:00
.gitattributes change line endings for easy patching 2020-05-25 09:46:53 +02:00
.gitignore Initial commit 2019-08-20 23:35:53 +02:00
CHANGELOG.md adjust CHANGELOG 2022-09-05 14:13:51 +02:00
composer.json fix non https url in composer.json 2020-06-08 10:14:56 +02:00
LICENSE Initial commit 2019-08-20 23:33:18 +02: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.