set error mode in pdo constructor
This commit is contained in:
parent
cd338e5aea
commit
9578e43722
@ -51,6 +51,8 @@ abstract class DB_PDO extends PDO {
|
|||||||
*/
|
*/
|
||||||
public function __construct($dsn, $username=NULL, $password=NULL, $driver_options=array())
|
public function __construct($dsn, $username=NULL, $password=NULL, $driver_options=array())
|
||||||
{
|
{
|
||||||
|
// Set PDO to display errors as exceptions
|
||||||
|
$driver_options[PDO::ATTR_ERRMODE] = PDO::ERRMODE_EXCEPTION;
|
||||||
parent::__construct($dsn, $username, $password, $driver_options);
|
parent::__construct($dsn, $username, $password, $driver_options);
|
||||||
|
|
||||||
// Load the sql class for the driver
|
// Load the sql class for the driver
|
||||||
@ -61,9 +63,6 @@ abstract class DB_PDO extends PDO {
|
|||||||
$class = get_class($this)."_util";
|
$class = get_class($this)."_util";
|
||||||
$this->util = new $class($this);
|
$this->util = new $class($this);
|
||||||
|
|
||||||
// Set PDO to display errors as exceptions
|
|
||||||
$this->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
|
||||||
|
|
||||||
// Set additional driver options, if they exist
|
// Set additional driver options, if they exist
|
||||||
if ( ! empty($driver_options) && is_array($driver_options))
|
if ( ! empty($driver_options) && is_array($driver_options))
|
||||||
{
|
{
|
||||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user