[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/libraries/vendor/joomla/database/src/Exception/ -> ExecutionFailureException.php (source)

   1  <?php
   2  /**
   3   * Part of the Joomla Framework Database Package
   4   *
   5   * @copyright  Copyright (C) 2005 - 2021 Open Source Matters, Inc. All rights reserved.
   6   * @license    GNU General Public License version 2 or later; see LICENSE
   7   */
   8  
   9  namespace Joomla\Database\Exception;
  10  
  11  /**
  12   * Exception class defining an error executing a statement
  13   *
  14   * @since  1.5.0
  15   */
  16  class ExecutionFailureException extends \RuntimeException
  17  {
  18      /**
  19       * The SQL statement that was executed.
  20       *
  21       * @var    string
  22       * @since  1.5.0
  23       */
  24      private $query;
  25  
  26      /**
  27       * Construct the exception
  28       *
  29       * @param   string     $query     The SQL statement that was executed.
  30       * @param   string     $message   The Exception message to throw. [optional]
  31       * @param   integer    $code      The Exception code. [optional]
  32       * @param   Exception  $previous  The previous exception used for the exception chaining. [optional]
  33       *
  34       * @since   1.5.0
  35       */
  36  	public function __construct($query, $message = '', $code = 0, \Exception $previous = null)
  37      {
  38          // PDO uses strings for exception codes, PHP forces numeric codes, so "force" the string code to be used
  39          parent::__construct($message, 0, $previous);
  40  
  41          $this->code  = $code;
  42          $this->query = $query;
  43      }
  44  
  45      /**
  46       * Get the SQL statement that was executed
  47       *
  48       * @return  string
  49       *
  50       * @since   1.5.0
  51       */
  52  	public function getQuery()
  53      {
  54          return $this->query;
  55      }
  56  }


Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer