diff --git a/extdbms/lib/Core/Model.php b/extdbms/lib/Core/Model.php index 3c08536..2ad8d7b 100644 --- a/extdbms/lib/Core/Model.php +++ b/extdbms/lib/Core/Model.php @@ -119,16 +119,20 @@ abstract class Model final public function execute(string $query): bool|PDOStatement { - if ($this->_debug) { - echo "\n
Query:" . $query . "\n
"; + try { + if ($this->_debug) { + echo "\n
Query:" . $query . "\n
"; + } + $this->_lastQuery = $query; + $stmt = $this->getConnect()->prepare($query); + $stmt->execute(); + if ($this->_reset) { + $this->reset(); + } + return $stmt; + } catch (\Exception $e) { + die($e->getMessage()); } - $this->_lastQuery = $query; - $stmt = $this->getConnect()->prepare($query); - $stmt->execute(); - if ($this->_reset) { - $this->reset(); - } - return $stmt; } //CURD문