diff --git a/extension/qfq/qfq/Database.php b/extension/qfq/qfq/Database.php index 53e9e11d20eefc1466cd8266e08dc65a1fbf89d7..6294700aefc07b498b668142a6513f83c897d58b 100644 --- a/extension/qfq/qfq/Database.php +++ b/extension/qfq/qfq/Database.php @@ -238,6 +238,7 @@ class Database { $sqlLogMode = $this->isSqlModify($sql) ? SQL_LOG_MODE_MODIFY : SQL_LOG_MODE_ALL;; $result = 0; $stat = array(); + $debugSql = ''; $this->store->setVar(SYSTEM_SQL_FINAL, $sql, STORE_SYSTEM); $this->store->setVar(SYSTEM_SQL_PARAM_ARRAY, $parameterArray, STORE_SYSTEM); @@ -245,18 +246,26 @@ class Database { // Logfile $this->dbLog($sqlLogMode, $sql, $parameterArray); + // If BE User is logged in: report the broken SQL as well. + + //TODO: im Fall von delete.php, save.php, kann hier der BE_USER nicht abgefragt werden (laeuft nicht durch T3) - Loesung finden. + + if (true) { + $debugSql = '[' . $sql . ']'; + } + if (false === ($this->mysqli_stmt = $this->mysqli->prepare($sql))) { - throw new DbException('[ mysqli: ' . $this->mysqli->errno . ' ] ' . $this->mysqli->error, ERROR_DB_PREPARE); + throw new DbException('[ mysqli: ' . $this->mysqli->errno . ' ] ' . $this->mysqli->error . $debugSql, ERROR_DB_PREPARE); } if (count($parameterArray) > 0) { if (false === $this->prepareBindParam($parameterArray)) { - throw new DbException('[ mysqli: ' . $this->mysqli_stmt->errno . ' ] ' . $this->mysqli_stmt->error, ERROR_DB_BIND); + throw new DbException('[ mysqli: ' . $this->mysqli_stmt->errno . ' ] ' . $this->mysqli_stmt->error . $debugSql, ERROR_DB_BIND); } } if (false === $this->mysqli_stmt->execute()) { - throw new DbException('[ mysqli: ' . $this->mysqli_stmt->errno . ' ] ' . $this->mysqli_stmt->error, ERROR_DB_EXECUTE); + throw new DbException('[ mysqli: ' . $this->mysqli_stmt->errno . ' ] ' . $this->mysqli_stmt->error . $debugSql, ERROR_DB_EXECUTE); } $msg = '';