diff --git a/authzgroups.php b/authzgroups.php index 74f1eb8..ba94be5 100644 --- a/authzgroups.php +++ b/authzgroups.php @@ -70,10 +70,17 @@ class authzgroups if ($user !== "cli" && $user !== "root") $st->bindValue (":user", $user); $st->bindValue (":module", $module); - $rc = $st->execute (); - if ($rc === false) + try { - if ($this->dbObject->debug) echo "DEBUG : EXECUTE ERROR ! Return FALSE\n"; + $rc = $st->execute (); + if ($rc === false) + throw new Exception ("Can't execute SQL request", 500); + } + catch (Exception $e) + { + if ($this->dbObject->debug) echo "DEBUG : EXECUTE ERROR ! Return FALSE". + $e->getMessage()."\n"; + throw new Exception ($e->getMessage(), 500); } $res = array (); while ($d = $st->fetch (PDO::FETCH_ASSOC)) @@ -301,6 +308,12 @@ class authzgroups return TRUE; } + /** Disconnect from the database. Should be only used in the unit tests */ + public function disconnect () + { + $this->dbObject->disconnect (); + } + /** Create the tables in the database to store the datas */ public function createTables () {