oxid-sql-logger/example/simple.php

24 lines
569 B
PHP
Raw Permalink Normal View History

2019-08-20 23:34:33 +02:00
<?php
2024-02-02 10:59:40 +01:00
declare(strict_types=1);
2022-08-18 14:18:43 +02:00
use OxidEsales\Eshop\Core\DatabaseProvider;
2019-08-20 23:34:33 +02:00
require __DIR__ . '/../../../../source/bootstrap.php';
2024-02-02 11:39:13 +01:00
D3StartSQLLog('Query for 100 items cheaper than 49,99');
2019-08-20 23:34:33 +02:00
2024-02-02 11:39:13 +01:00
$db = DatabaseProvider::getDb(DatabaseProvider::FETCH_MODE_ASSOC);
$list = $db->getAll('SELECT * '.PHP_EOL.'FROM oxarticles WHERE oxprice < ? LIMIT 100', [49.99]);
2019-08-20 23:34:33 +02:00
2022-08-18 14:18:43 +02:00
D3StopSQLLog();
2019-09-20 16:05:36 +02:00
// or
2022-08-18 14:18:43 +02:00
D3StartSQLLog();
2019-09-20 16:05:36 +02:00
2024-02-02 11:39:13 +01:00
$db = DatabaseProvider::getDb(DatabaseProvider::FETCH_MODE_ASSOC);
2019-09-20 16:05:36 +02:00
$list = $db->getAll('SELECT * FROM oxarticles WHERE oxprice < ? LIMIT 100', [49.99]);
2022-08-18 14:18:43 +02:00
D3StopSQLLog();