Add a PDO exception if PDO has a problem
git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@1408 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
11
dblayer.php
11
dblayer.php
@@ -76,8 +76,15 @@ class dblayer extends PDO
|
|||||||
function __construct ($dsn, $username=null, $password=null,
|
function __construct ($dsn, $username=null, $password=null,
|
||||||
$driver_options=null)
|
$driver_options=null)
|
||||||
{
|
{
|
||||||
$this->db = new PDO ($dsn, $username, $password, $driver_options);
|
try
|
||||||
$this->db->setAttribute (PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
{
|
||||||
|
$this->db = new PDO ($dsn, $username, $password, $driver_options);
|
||||||
|
$this->db->setAttribute (PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||||
|
}
|
||||||
|
catch (Exception $e)
|
||||||
|
{
|
||||||
|
throw new Exception ("PDO error : ".$e->getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Create a new entry in the table. Datas must be an indexed array
|
/** Create a new entry in the table. Datas must be an indexed array
|
||||||
|
|||||||
Reference in New Issue
Block a user