diff --git a/src/Model/Database.php b/src/Model/Database.php index a52f700e..987f71b9 100644 --- a/src/Model/Database.php +++ b/src/Model/Database.php @@ -60,13 +60,22 @@ public function reconnect() */ public function query($query) { + if ($this->debug_mode) + { + echo $query; + + $this->debug_mode = false; + + return false; + } try { - return parent::query($query); + + return $this->pdo->query($query); } catch (Exception $e) { $this->reconnect(); - - return parent::query($query); + return $this->pdo->query($query); } + } /** @@ -78,12 +87,20 @@ public function query($query) */ public function exec($query) { + if ($this->debug_mode) + { + echo $query; + + $this->debug_mode = false; + + return false; + } + try { - return parent::exec($query); + return $this->pdo->exec($query); } catch (Exception $e) { $this->reconnect(); - - return parent::exec($query); + return $this->pdo->exec($query); } }