Private GIT

Skip to content
Snippets Groups Projects
Unverified Commit ea9e014a authored by Kevin Duret's avatar Kevin Duret Committed by GitHub
Browse files

enh(pdo): do not manage pdo exception on lowest level of application (#6265)

* enh(pdo): do not manage pdo exception on lowest level of application

* fix(pdo): fix exception thrown in centreon DB class
parent 3a73f4b5
Branches
No related tags found
No related merge requests found
...@@ -227,15 +227,6 @@ class CentreonDB extends \PDO ...@@ -227,15 +227,6 @@ class CentreonDB extends \PDO
$parameters = array($parameters); $parameters = array($parameters);
} }
/*
* LOG all request
*/
if ($this->debug) {
$string = str_replace("`", "", $queryString);
$string = str_replace('*', "\*", $string);
$this->log->insertLog(2, " QUERY : " . $string);
}
/* /*
* Launch request * Launch request
*/ */
...@@ -249,8 +240,13 @@ class CentreonDB extends \PDO ...@@ -249,8 +240,13 @@ class CentreonDB extends \PDO
} }
$this->queryNumber++; $this->queryNumber++;
$this->successQueryNumber++; $this->successQueryNumber++;
} catch (PDOException $e) { } catch (\PDOException $e) {
echo $e->getMessage(); if ($this->debug) {
$string = str_replace("`", "", $queryString);
$string = str_replace('*', "\*", $string);
$this->log->insertLog(2, " QUERY : " . $string);
}
throw new \PDOException($e->getMessage(), $e->getCode());
} }
return $sth; return $sth;
...@@ -272,10 +268,11 @@ class CentreonDB extends \PDO ...@@ -272,10 +268,11 @@ class CentreonDB extends \PDO
$result = $this->query($query_string); $result = $this->query($query_string);
$rows = $result->fetchAll(); $rows = $result->fetchAll();
$this->requestSuccessful++; $this->requestSuccessful++;
} catch (\Exception $e) { } catch (\PDOException $e) {
if ($this->debug) { if ($this->debug) {
$this->log->insertLog(2, $e->getMessage() . " QUERY : " . $query_string); $this->log->insertLog(2, $e->getMessage() . " QUERY : " . $query_string);
} }
throw new \PDOException($e->getMessage(), $e->getCode());
} }
return $rows; return $rows;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment