adjust documentation

This commit is contained in:
Daniel Seifert 2019-09-20 16:05:36 +02:00
parent 7705abd09e
commit bd16bf36cd
7 changed files with 25 additions and 8 deletions

View File

@ -6,8 +6,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased] ## [Unreleased]
## [1.1.0] - 2019-09-20
### Added
- add log message
- add position specifications of the calling source code
## [1.0.0] - 2019-07-21 ## [1.0.0] - 2019-07-21
available in tumtum/oxid-sql-logger package only
### Added ### Added
- Global function `StartSQLLog` and `StopSQLLog` - Global function `StartSQLLog` and `StopSQLLog`

View File

@ -5,19 +5,19 @@ Returns all SQL queries into console of a Browser.
## Install ## Install
`composer require --dev tumtum/oxid-sql-logger` `composer require --dev d3/oxid-sql-logger`
## Usage ## Usage
Just set the function `StartSQLLog()` somewhere and from that point on all SQLs will be logged. Just set the function `D3StartSQLLog()` somewhere and from that point on all SQLs will be logged.
```php ```php
\StartSQLLog(); \D3StartSQLLog('specific log message');
$db = \OxidEsales\Eshop\Core\DatabaseProvider::getDb(\OxidEsales\Eshop\Core\DatabaseProvider::FETCH_MODE_ASSOC); $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]); $list = $db->getAll('SELECT * FROM oxarticles WHERE oxprice < ? LIMIT 100', [49.99]);
\StopSQLLog(); \D3StopSQLLog();
``` ```
## Screenshots ## Screenshots
@ -25,9 +25,8 @@ $list = $db->getAll('SELECT * FROM oxarticles WHERE oxprice < ? LIMIT 100', [49.
Browser: Browser:
![Example all sqls](https://raw.githubusercontent.com/TumTum/oxid-sql-logger/master/img/screenshot-a.jpg) ![Example all sqls](https://raw.githubusercontent.com/TumTum/oxid-sql-logger/master/img/screenshot-a.jpg)
![Example only one range](https://raw.githubusercontent.com/TumTum/oxid-sql-logger/master/img/screenshot-b.png)
CLI: CLI:
![Example CLI](https://raw.githubusercontent.com/TumTum/oxid-sql-logger/master/img/screenshot-cli.png) ![Example CLI](https://raw.githubusercontent.com/TumTum/oxid-sql-logger/master/img/screenshot-cli.jpg)

View File

@ -2,9 +2,18 @@
require __DIR__ . '/../../../../source/bootstrap.php'; require __DIR__ . '/../../../../source/bootstrap.php';
\StartSQLLog(); \D3StartSQLLog('Query for 100 items cheaper than 49,99');
$db = \OxidEsales\Eshop\Core\DatabaseProvider::getDb(\OxidEsales\Eshop\Core\DatabaseProvider::FETCH_MODE_ASSOC); $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]); $list = $db->getAll('SELECT * FROM oxarticles WHERE oxprice < ? LIMIT 100', [49.99]);
\StopSQLLog(); \D3StopSQLLog();
// or
\D3StartSQLLog();
$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();

Binary file not shown.

Before

Width:  |  Height:  |  Size: 824 KiB

After

Width:  |  Height:  |  Size: 166 KiB

Binary file not shown.

BIN
img/screenshot-cli.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.