diff --git a/drivers/firebird/firebird_driver.php b/drivers/firebird/firebird_driver.php index 7ab838b..567b1c8 100644 --- a/drivers/firebird/firebird_driver.php +++ b/drivers/firebird/firebird_driver.php @@ -207,7 +207,7 @@ class Firebird extends Abstract_Driver { $err_string = \fbird_errmsg() . "Last query:" . $this->last_query; if ($this->statement_link === FALSE) throw new \PDOException($err_string, \fbird_errcode(), NULL); - $this->statement = new FireBird_Result($this->statement_link); + $this->statement = new FireBird_Result($this->statement_link, $this); return $this->statement; } @@ -229,7 +229,7 @@ class Firebird extends Abstract_Driver { // Throw the error as an exception if ($this->statement_link === FALSE) throw new \PDOException(\fbird_errmsg(), \fbird_errcode(), NULL); - $this->statement = new FireBird_Result($this->statement_link); + $this->statement = new FireBird_Result($this->statement_link, $this); return $this->statement; } diff --git a/drivers/firebird/firebird_result.php b/drivers/firebird/firebird_result.php index 54c5f54..54189a0 100644 --- a/drivers/firebird/firebird_result.php +++ b/drivers/firebird/firebird_result.php @@ -45,14 +45,23 @@ class Firebird_Result extends \PDOStatement { */ private $result = array(); + /** + * Reference to the db drive to de-duplicate error functions + * + * @var \Query\Driver\Firebird + */ + private $db; + /** * Create the object by passing the resource for * the query * * @param resource $link + * @param [\Query\Driver\Firebird] $db */ - public function __construct($link) + public function __construct($link, Driver_Interface $db = NULL) { + if ( ! is_null($db)) $this->db = $db; $this->statement = $link; $this->setFetchMode(\PDO::FETCH_ASSOC); $this->row = -1; @@ -271,7 +280,7 @@ class Firebird_Result extends \PDOStatement { */ public function errorCode() { - return \fbird_errcode(); + return $this->db->errorCode(); } // -------------------------------------------------------------------------- @@ -283,10 +292,7 @@ class Firebird_Result extends \PDOStatement { */ public function errorInfo() { - $code = \fbird_errcode(); - $msg = \fbird_errmsg(); - - return array(0, $code, $msg); + return $this->db->errorInfo(); } } // End of firebird_result.php \ No newline at end of file diff --git a/drivers/firebird/firebird_util.php b/drivers/firebird/firebird_util.php index 00001e7..3270653 100644 --- a/drivers/firebird/firebird_util.php +++ b/drivers/firebird/firebird_util.php @@ -34,10 +34,9 @@ class Firebird_Util extends Abstract_Util { * @param string $name * @param array $fields * @param array $constraints - * @param array $indexes * @return string */ - public function create_table($name, $fields, array $constraints=array(), array $indexes=array()) + public function create_table($name, $fields, array $constraints=array()) { $column_array = array();