aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/DB/BacktraceDebugStack.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/DB/BacktraceDebugStack.php')
-rw-r--r--lib/private/DB/BacktraceDebugStack.php20
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/private/DB/BacktraceDebugStack.php b/lib/private/DB/BacktraceDebugStack.php
new file mode 100644
index 00000000000..4afd3ce6a13
--- /dev/null
+++ b/lib/private/DB/BacktraceDebugStack.php
@@ -0,0 +1,20 @@
+<?php
+
+declare(strict_types=1);
+/**
+ * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+
+namespace OC\DB;
+
+use Doctrine\DBAL\Logging\DebugStack;
+
+class BacktraceDebugStack extends DebugStack {
+ public function startQuery($sql, ?array $params = null, ?array $types = null) {
+ parent::startQuery($sql, $params, $types);
+ $backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
+ $this->queries[$this->currentQuery]['backtrace'] = $backtrace;
+ $this->queries[$this->currentQuery]['start'] = $this->start;
+ }
+}