mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
# Conflicts: # README.md # composer.json # composer.lock # core/cmdbsource.class.inc.php # core/dbobject.class.php # datamodels/2.x/combodo-db-tools/db_analyzer.class.inc.php # datamodels/2.x/combodo-db-tools/dbtools.php # datamodels/2.x/combodo-db-tools/dictionaries/zh_cn.dict.combodo-db-tools.php # datamodels/2.x/itop-attachments/dictionaries/zh_cn.dict.itop-attachments.php # datamodels/2.x/itop-core-update/dictionaries/zh_cn.dict.itop-core-update.php # dictionaries/zh_cn.dictionary.itop.core.php # dictionaries/zh_cn.dictionary.itop.ui.php # lib/composer/InstalledVersions.php # lib/composer/autoload_classmap.php # lib/composer/autoload_static.php # lib/composer/installed.php # lib/composer/platform_check.php # pages/ajax.render.php # pages/csvimport.php # setup/ajax.dataloader.php # setup/index.php # setup/setuputils.class.inc.php # test/application/UtilsTest.php
39 lines
1.2 KiB
PHP
39 lines
1.2 KiB
PHP
<?php
|
|
/*
|
|
* @copyright Copyright (C) 2010-2021 Combodo SARL
|
|
* @license http://opensource.org/licenses/AGPL-3.0
|
|
*/
|
|
|
|
class MySQLException extends CoreException
|
|
{
|
|
/**
|
|
* MySQLException constructor.
|
|
*
|
|
* @param string $sIssue
|
|
* @param array $aContext
|
|
* @param \Exception $oException
|
|
* @param \mysqli $oMysqli to use when working with a custom mysqli instance
|
|
*/
|
|
public function __construct($sIssue, $aContext, $oException = null, $oMysqli = null)
|
|
{
|
|
if ($oException != null) {
|
|
$aContext['mysql_errno'] = $oException->getCode();
|
|
$this->code = $oException->getCode();
|
|
$aContext['mysql_error'] = $oException->getMessage();
|
|
} else if ($oMysqli != null) {
|
|
$aContext['mysql_errno'] = $oMysqli->errno;
|
|
$this->code = $oMysqli->errno;
|
|
$aContext['mysql_error'] = $oMysqli->error;
|
|
} else {
|
|
$aContext['mysql_errno'] = CMDBSource::GetErrNo();
|
|
$this->code = CMDBSource::GetErrNo();
|
|
$aContext['mysql_error'] = CMDBSource::GetError();
|
|
}
|
|
parent::__construct($sIssue, $aContext);
|
|
//if is connection error, don't log the default message with password in
|
|
if (mysqli_connect_errno()) {
|
|
error_log($this->message);
|
|
error_reporting(0);
|
|
}
|
|
}
|
|
} |