From 233847403d930a78b7b64e5810b7eea7aaab0019 Mon Sep 17 00:00:00 2001 From: "dorian.hodin" Date: Mon, 6 Mar 2023 15:51:08 +0100 Subject: [PATCH] Finalyse API, prepare databaseScript.php --- .idea/sqldialects.xml | 1 + Source/API/script/Config/ConnectClass.php | 1 + Source/API/script/Config/databaseScript.php | 13 +++++++++---- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.idea/sqldialects.xml b/.idea/sqldialects.xml index b58a74b..27b5e7c 100644 --- a/.idea/sqldialects.xml +++ b/.idea/sqldialects.xml @@ -1,6 +1,7 @@ + diff --git a/Source/API/script/Config/ConnectClass.php b/Source/API/script/Config/ConnectClass.php index 440d095..6c741c2 100644 --- a/Source/API/script/Config/ConnectClass.php +++ b/Source/API/script/Config/ConnectClass.php @@ -21,6 +21,7 @@ class ConnectClass{ function connect(): int|Connection { try { + echo " "; $connection = new Connection($this->dsn,$this->login,$this->password); }catch (PDOException $e){ throw new PDOException($e->getMessage(), $e->getCode(), $e); diff --git a/Source/API/script/Config/databaseScript.php b/Source/API/script/Config/databaseScript.php index c65d649..356f950 100644 --- a/Source/API/script/Config/databaseScript.php +++ b/Source/API/script/Config/databaseScript.php @@ -1,12 +1,17 @@ con = connect(); + try{ + $this->connection = (new ConnectClass)->connect(); + }catch(PDOException $e){ + throw new PDOException($e->getMessage(), $e->getCode(), $e); + } } public function executeScript(): void @@ -110,10 +115,10 @@ ALTER TABLE `Submit` COMMIT;'; - $this->con->executeQuery($queryScript); + $this->connection->executeQuery($queryScript); try { $test = "SELECT * FROM Categorize;"; - $this->con->executeQuery($test); + $this->connection->executeQuery($test); }catch (Exception $e){ echo $e->getMessage(); }