set error mode in pdo constructor

This commit is contained in:
Timothy Warren 2013-05-29 13:57:08 -04:00
parent cd338e5aea
commit 9578e43722
2 changed files with 2 additions and 3 deletions

View File

@ -51,6 +51,8 @@ abstract class DB_PDO extends PDO {
*/
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);
// Load the sql class for the driver
@ -61,9 +63,6 @@ abstract class DB_PDO extends PDO {
$class = get_class($this)."_util";
$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
if ( ! empty($driver_options) && is_array($driver_options))
{

Binary file not shown.