Convert all errors to execeptions
This commit is contained in:
parent
4b5ba2a7dc
commit
9b3a242b04
12
index.php
12
index.php
@ -26,7 +26,7 @@ error_reporting(-1 & ~(E_STRICT));
|
|||||||
// Set the stupid timezone so PHP shuts up.
|
// Set the stupid timezone so PHP shuts up.
|
||||||
date_default_timezone_set('GMT');
|
date_default_timezone_set('GMT');
|
||||||
|
|
||||||
// Don't set an arbitary memory limit!
|
// Don't set an arbitrary memory limit!
|
||||||
ini_set('memory_limit', -1);
|
ini_set('memory_limit', -1);
|
||||||
|
|
||||||
// Set the current directory as the base for included files
|
// Set the current directory as the base for included files
|
||||||
@ -75,6 +75,16 @@ if( ! class_exists('pdo'))
|
|||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Convert Errors to Exceptions
|
||||||
|
// Do this after the two compatibility checks for cleaner output
|
||||||
|
function exception_error_handler($errno, $errstr, $errfile, $errline)
|
||||||
|
{
|
||||||
|
throw new ErrorException($errstr, 0, $errno, $errfile, $errline);
|
||||||
|
}
|
||||||
|
set_error_handler("exception_error_handler", -1);
|
||||||
|
|
||||||
|
// --------------------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Alias for require_once for array_map
|
* Alias for require_once for array_map
|
||||||
*
|
*
|
||||||
|
@ -30,14 +30,14 @@ class firebird extends DB_PDO {
|
|||||||
*/
|
*/
|
||||||
public function __construct($dbpath, $user='sysdba', $pass='masterkey')
|
public function __construct($dbpath, $user='sysdba', $pass='masterkey')
|
||||||
{
|
{
|
||||||
$this->conn = @fbird_connect($dbpath, $user, $pass, 'utf-8');
|
$this->conn = fbird_connect($dbpath, $user, $pass, 'utf-8');
|
||||||
|
|
||||||
// Throw an exception to make this match other pdo classes
|
// Throw an exception to make this match other pdo classes
|
||||||
if ( ! is_resource($this->conn))
|
/*if ( ! is_resource($this->conn))
|
||||||
{
|
{
|
||||||
throw new PDOException(fbird_errmsg());
|
throw new PDOException(fbird_errmsg());
|
||||||
die();
|
die();
|
||||||
}
|
}*/
|
||||||
|
|
||||||
$class = __CLASS__."_sql";
|
$class = __CLASS__."_sql";
|
||||||
$this->sql = new $class;
|
$this->sql = new $class;
|
||||||
@ -91,8 +91,8 @@ class firebird extends DB_PDO {
|
|||||||
$this->count = 0;
|
$this->count = 0;
|
||||||
|
|
||||||
$this->statement_link = (isset($this->trans))
|
$this->statement_link = (isset($this->trans))
|
||||||
? @fbird_query($this->trans, $sql)
|
? fbird_query($this->trans, $sql)
|
||||||
: @fbird_query($this->conn, $sql);
|
: fbird_query($this->conn, $sql);
|
||||||
|
|
||||||
// Throw the error as a exception
|
// Throw the error as a exception
|
||||||
if ($this->statement_link === FALSE)
|
if ($this->statement_link === FALSE)
|
||||||
@ -115,7 +115,7 @@ class firebird extends DB_PDO {
|
|||||||
*/
|
*/
|
||||||
public function prepare($query, $options=NULL)
|
public function prepare($query, $options=NULL)
|
||||||
{
|
{
|
||||||
$this->statement_link = @fbird_prepare($this->conn, $query);
|
$this->statement_link = fbird_prepare($this->conn, $query);
|
||||||
|
|
||||||
// Throw the error as an exception
|
// Throw the error as an exception
|
||||||
if ($this->statement_link === FALSE)
|
if ($this->statement_link === FALSE)
|
||||||
|
@ -136,7 +136,7 @@ class Firebird_SQL extends DB_SQL {
|
|||||||
*/
|
*/
|
||||||
public function backup_structure()
|
public function backup_structure()
|
||||||
{
|
{
|
||||||
// @todo Implement Backup function
|
// @todo Implement Backup structure function
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user