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