tumtum/oxid-sql-logger

在浏览器中返回所有 SQL 查询。

1.2.0 2021-09-16 14:58 UTC

This package is auto-updated.

Last update: 2024-09-16 21:20:05 UTC


README

Build Status

将所有 SQL 查询返回到浏览器的控制台。

安装

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

用法

只需在某处设置函数 StartSQLLog(),从此点开始所有 SQL 将被记录。

\StartSQLLog();

$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]);

\StopSQLLog();

截图

浏览器

Example only one range

命令行界面

Example CLI

SQL 查询状态监控

Example CLI

查看已添加到数据库的查询数量和查询类型。以确定数量。

开启

为此,必须在文件 config.ing.php 中存储参数 $this->blSQLStatusBox = true;。这样您可以临时打开和关闭它。

唯一:最后,在 base.tpl 文件中插入 Smarty 标签:[{tm_sql_status}]

####### 源代码/Application/views/flow/tpl/layout/base.tpl

        [{tm_sql_status}]
        </body>
    </html>