From: Davide Franco Date: Sun, 17 Jul 2011 20:01:45 +0000 (+0200) Subject: bacula-web: Fixed small bug and removed useless code in CDB class X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=26941690d6d8fc6be7979a1b8bcf759b80b5530b;p=bacula%2Fbacula bacula-web: Fixed small bug and removed useless code in CDB class - Removed TriggerDBError() function - Removed getResult() function - Removed old unused code --- diff --git a/gui/bacula-web/includes/db/cdb.class.php b/gui/bacula-web/includes/db/cdb.class.php index 215b9a398a..cb2cbc0c9e 100644 --- a/gui/bacula-web/includes/db/cdb.class.php +++ b/gui/bacula-web/includes/db/cdb.class.php @@ -61,37 +61,20 @@ class CDB public function runQuery( $query) { - $this->result =& $this->connection->prepare( $query ); + $this->result = $this->connection->prepare( $query ); - if(!$this->result) - throw new CDBError("Failed to execute query
$query"); + if( !is_a( $this->result, 'CDBResult') ) + throw new PDOException("Failed to execute query
$query"); if( !$this->result->execute() ) - throw new CDBError("Failed to execute query
$query"); - - if( !PEAR::isError($this->result) ) - return true; - } - - public function getResult() - { - $result = $this->result->fetchAll(); - $this->result_nb = count( $result ); - return $result; + throw new PDOException("Failed to execute query
$query"); + + return $this->result; } public function countResult() { return $this->result_nb; } - - public function triggerError( $message, $db_error) - { - echo 'Error: ' . $message . '
'; - echo 'Standard Message: ' . $db_error->getMessage() . '
'; - echo 'Standard Code: ' . $db_error->getCode() . '
'; - echo 'DBMS/User Message: ' . $db_error->getUserInfo() . '
'; - echo 'DBMS/Debug Message: ' . $db_error->getDebugInfo() . '
'; - } } ?>