Compare commits
No commits in common. "1.2.2" and "1.2.1" have entirely different histories.
BIN
.gitattributes
vendored
BIN
.gitattributes
vendored
Binary file not shown.
@ -15,10 +15,7 @@ use Doctrine\DBAL\Configuration;
|
||||
*/
|
||||
class OxidEsalesDatabase extends \OxidEsales\Eshop\Core\Database\Adapter\Doctrine\Database
|
||||
{
|
||||
/**
|
||||
* @throws \OxidEsales\Eshop\Core\Exception\DatabaseConnectionException
|
||||
*/
|
||||
public function d3EnableLogger($message)
|
||||
public static function enableLogger($message = null)
|
||||
{
|
||||
$trace = debug_backtrace((PHP_VERSION_ID < 50306) ? 2 : DEBUG_BACKTRACE_IGNORE_ARGS);
|
||||
|
||||
@ -36,20 +33,17 @@ class OxidEsalesDatabase extends \OxidEsales\Eshop\Core\Database\Adapter\Doctrin
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
* @return OxidSQLLogger
|
||||
* @throws \OxidEsales\Eshop\Core\Exception\DatabaseConnectionException
|
||||
*/
|
||||
public function d3GetLogger()
|
||||
public static function getLogger()
|
||||
{
|
||||
$database = \OxidEsales\Eshop\Core\DatabaseProvider::getDb(\OxidEsales\Eshop\Core\DatabaseProvider::FETCH_MODE_ASSOC);
|
||||
$dbalConfig = $database->getConnection()->getConfiguration();
|
||||
return $dbalConfig->getSQLLogger();
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \OxidEsales\Eshop\Core\Exception\DatabaseConnectionException
|
||||
*/
|
||||
public function d3DisableLogger()
|
||||
public static function disableLogger()
|
||||
{
|
||||
$database = \OxidEsales\Eshop\Core\DatabaseProvider::getDb(\OxidEsales\Eshop\Core\DatabaseProvider::FETCH_MODE_ASSOC);
|
||||
$dbalConfig = $database->getConnection()->getConfiguration();
|
||||
|
@ -7,7 +7,6 @@
|
||||
|
||||
namespace D3\OxidSqlLogger;
|
||||
|
||||
use D3\ModCfg\Application\Model\d3database;
|
||||
use Doctrine\DBAL\Logging\SQLLogger;
|
||||
use Monolog;
|
||||
use NilPortugues\Sql\QueryFormatter\Formatter;
|
||||
@ -54,8 +53,6 @@ class OxidSQLLogger implements SQLLogger
|
||||
$this->stopQuery();
|
||||
}
|
||||
|
||||
$this->getPreparedStatementQuery($sql, $params);
|
||||
|
||||
$this->SQLQuery = (new SQLQuery()) ->setSql($sql)
|
||||
->setParams($params)
|
||||
->setTypes($types)
|
||||
@ -65,23 +62,6 @@ class OxidSQLLogger implements SQLLogger
|
||||
->setLogStartingFunction($this->logStartingFunction);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sql
|
||||
* @param array $params
|
||||
* @throws \OxidEsales\Eshop\Core\Exception\DatabaseConnectionException
|
||||
*/
|
||||
public function getPreparedStatementQuery(&$sql, array $params = null)
|
||||
{
|
||||
if (class_exists(d3database::class)
|
||||
&& method_exists(d3database::class, 'getPreparedStatementQuery')
|
||||
&& count($params)
|
||||
&& ($query = d3database::getInstance()->getPreparedStatementQuery($sql, $params))
|
||||
&& strlen(trim($query))
|
||||
) {
|
||||
$sql = $query;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
|
@ -6,14 +6,9 @@
|
||||
*/
|
||||
|
||||
function D3StartSQLLog($message = null) {
|
||||
/** @var \D3\OxidSqlLogger\OxidEsalesDatabase $database */
|
||||
$database = oxNew(\D3\OxidSqlLogger\OxidEsalesDatabase::class);
|
||||
$database->d3EnableLogger($message);
|
||||
\D3\OxidSqlLogger\OxidEsalesDatabase::enableLogger($message);
|
||||
}
|
||||
|
||||
function D3StopSQLLog()
|
||||
{
|
||||
/** @var \D3\OxidSqlLogger\OxidEsalesDatabase $database */
|
||||
$database = oxNew(\D3\OxidSqlLogger\OxidEsalesDatabase::class);
|
||||
$database->d3DisableLogger();
|
||||
function D3StopSQLLog() {
|
||||
\D3\OxidSqlLogger\OxidEsalesDatabase::disableLogger();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user