From 37201799b505553a6944e5eaacd813be0b0610f3 Mon Sep 17 00:00:00 2001 From: Clemens Schwaighofer Date: Mon, 10 Apr 2023 17:17:34 +0900 Subject: [PATCH] DB\IO params debug output fix for dbReturn/dbReturnParams calls Those two calls did not replace the params with values for debug output --- www/lib/CoreLibs/DB/IO.php | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/www/lib/CoreLibs/DB/IO.php b/www/lib/CoreLibs/DB/IO.php index b2b0b8d1..aefa738c 100644 --- a/www/lib/CoreLibs/DB/IO.php +++ b/www/lib/CoreLibs/DB/IO.php @@ -1146,7 +1146,7 @@ class IO $this->params ), '__dbPrepareExec', - ($this->params === [] ? 'Q' : 'Qp'), + ($this->params === [] ? 'Q' : 'Qp') ); } // import protection, hash needed @@ -1166,7 +1166,15 @@ class IO $this->query_called[$query_hash] > $this->MAX_QUERY_CALL ) { $this->__dbError(30, false, $this->query); - $this->__dbDebug('db', $this->query, 'dbExec', 'Q[nc]'); + $this->__dbDebug( + 'db', + $this->__dbDebugPrepare( + $this->query, + $this->params + ), + 'dbExec', + ($this->params === [] ? 'Q[nc]' : 'Qp[nc]') + ); return false; } $this->query_called[$query_hash] ++; @@ -1968,7 +1976,15 @@ class IO $this->cursor_ext[$query_hash]['log'][] = 'No cursor'; // for DEBUG, print out each query executed if ($this->db_debug) { - $this->__dbDebug('db', $this->cursor_ext[$query_hash]['query'], 'dbReturn', 'Q'); + $this->__dbDebug( + 'db', + $this->__dbDebugPrepare( + $this->cursor_ext[$query_hash]['query'], + $this->cursor_ext[$query_hash]['params'] + ), + 'dbReturn', + ($this->cursor_ext[$query_hash]['params'] === [] ? 'Q' : 'Qp'), + ); } // if no DB Handler try to reconnect if (!$this->dbh) { @@ -1997,7 +2013,15 @@ class IO // if still no cursor ... if (!$this->cursor_ext[$query_hash]['cursor']) { if ($this->db_debug) { - $this->__dbDebug('db', $this->cursor_ext[$query_hash]['query'], 'dbReturn', 'Q'); + $this->__dbDebug( + 'db', + $this->__dbDebugPrepare( + $this->cursor_ext[$query_hash]['query'], + $this->cursor_ext[$query_hash]['params'] + ), + 'dbReturn', + ($this->cursor_ext[$query_hash]['params'] === [] ? 'Q[e]' : 'Qp[e]'), + ); } // internal error handling $this->__dbError(13, $this->cursor_ext[$query_hash]['cursor']);