authzgroups : Raise an exception if there is a SQL error

git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@2453 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
2016-02-15 15:03:33 +00:00
parent 083e803c09
commit 0b950a315f

View File

@@ -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 ()
{