diff --git a/sys/databases/firebird-ibase.php b/sys/databases/firebird-ibase.php index 5c828a4..815510c 100644 --- a/sys/databases/firebird-ibase.php +++ b/sys/databases/firebird-ibase.php @@ -36,6 +36,7 @@ class firebird extends DB_PDO { // functions that would use it, I'm dumping it. $conn = @ibase_connect($dbpath, $user, $pass, 'utf-8'); + // Throw an exception to make this match other pdo classes if ( ! is_resource($conn)) { throw new PDOException(ibase_errmsg()); @@ -86,11 +87,19 @@ class firebird extends DB_PDO { if (isset($this->trans)) { - $this->statement = ibase_query($this->trans, $sql); + $this->statement = @ibase_query($this->trans, $sql); } else { - $this->statement = ibase_query($sql); + $this->statement = @ibase_query($sql); + } + + // Throw the error as a exception + // if there is one + if ( ! is_resource($this->statement)) + { + throw new PDOException(ibase_errmsg()); + die(); } return $this->statement; @@ -154,7 +163,15 @@ class firebird extends DB_PDO { */ public function prepare($query, $options=NULL) { - $this->statement = ibase_prepare($query); + $this->statement = @ibase_prepare($query); + + // Throw the error as an exception + if ( ! is_resource($this->statement)) + { + throw new PDOException(ibase_errmsg()); + die(); + } + return $this->statement; } diff --git a/sys/windows/widgets/db_info_widget.php b/sys/windows/widgets/db_info_widget.php index 071af3f..bf96ed2 100644 --- a/sys/windows/widgets/db_info_widget.php +++ b/sys/windows/widgets/db_info_widget.php @@ -249,6 +249,10 @@ class DB_Info_Widget extends GtkTable { return; } + // Catch connection exceptions, and + // display the error message to the + // user so they can edit the db + // parameters try { $db = new Query_Builder($params); @@ -264,49 +268,7 @@ class DB_Info_Widget extends GtkTable { ); $dialog->run(); $dialog->destroy(); - - return; } - - // Sometimes there's not an exception, - // check for an error so as not to - // give false positive connections - $errorInfo = $db->errorInfo(); - if(empty($errorInfo)) - { - $dialog = new GTKMessageDialog( - NULL, - Gtk::DIALOG_MODAL, - Gtk::MESSAGE_INFO, - Gtk::BUTTONS_OK, - "Successfully connected" - ); - } - else - { - $err = $db->errorInfo(); - - $msg = $err[count($err) - 1]; - $code = $err[1]; - - $dialog = new GTKMessageDialog( - NULL, - Gtk::DIALOG_MODAL, - Gtk::MESSAGE_ERROR, - Gtk::BUTTONS_OK, - "Error connecting to database: \n\n" . - "Error # {$code}\n". - $msg - ); - - } - - - - $dialog->run(); - $dialog->destroy(); - - return; } /**