3  * SPDX-License-Identifier: GPL-2.0-only
 
   5  * This file is part of Nominatim. (https://nominatim.org)
 
   7  * Copyright (C) 2022 by the Nominatim developer community.
 
   8  * For a full list of authors see the git log.
 
  13 class DatabaseError extends \Exception
 
  16     public function __construct($message, $code, $previous, $oPDOErr, $sSql = null)
 
  18         parent::__construct($message, $code, $previous);
 
  19         // https://secure.php.net/manual/en/class.pdoexception.php
 
  20         $this->oPDOErr = $oPDOErr;
 
  24     public function __toString()
 
  26         return __CLASS__ . ": [{$this->code}]: {$this->message}\n";
 
  29     public function getSqlError()
 
  31         return $this->oPDOErr->getMessage();
 
  34     public function getSqlDebugDump()
 
  37             return var_export($this->oPDOErr, true);