diff --git a/WEB/Config/Connection.php b/WEB/Config/Connection.php index 45677c0a..18c1fbc6 100644 --- a/WEB/Config/Connection.php +++ b/WEB/Config/Connection.php @@ -19,26 +19,33 @@ class Connection extends SQLite3 { - private $stmt; - private $result; - function __construct($dsn) + private $stmt; + private $result; + function __construct($dsn) { + global $rep, $vues, $error; $this->enableExceptions(true); - parent::__construct($dsn, SQLITE3_OPEN_READWRITE); - } - public function executeQuery(string $query, array $parameters = []): bool - { - $this->stmt = parent::prepare($query); - foreach ($parameters as $name => $value) { - $this->stmt->bindValue($name, $value[0], $value[1]); + try + { + parent::__construct($dsn, SQLITE3_OPEN_READWRITE ); + } + catch(Exception $e) { + $error = $e->getMessage(); + require ($rep.$vues['erreur']); } - $this->result = $this->stmt->execute(); - return $this->result; } - public function getResults(): array - { - return $this->result->fetchArray(); - } -} + public function executeQuery(string $query, array $parameters = []) :bool { + $this->stmt = parent::prepare($query); + foreach ($parameters as $name => $value) { + $this->stmt->bindValue($name, $value[0], $value[1]); + } + $this->result=$this->stmt->execute(); + return $this->result; + } + + public function getResults(): array { + return $this->result->fetchArray(); + } +} \ No newline at end of file