3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
12 namespace Civi\Core\Event
;
16 * @package Civi\Core\Event
18 * The QueryEvent fires whenever a SQL query is executed.
20 class QueryEvent
extends \Symfony\Component\EventDispatcher\Event
{
30 * QueryEvent constructor.
31 * @param string $query
33 public function __construct($query) {
34 $this->query
= $query;
38 * @return string|FALSE
39 * Ex: 'SELECT', 'INSERT', 'CREATE', 'ALTER'
40 * A FALSE value indicates that a singular verb could not be identified.
42 public function getVerb() {
43 if ($this->verb
=== NULL) {
44 if (preg_match(';(/\*.*/\*\s*)?([a-zA-Z]+) ;', $this->query
, $m)) {
45 $this->verb
= strtolower($m[2]);