]> git.sur5r.net Git - bacula/bacula/commitdiff
bacula-web: Fixed small bug and removed useless code in CDB class
authorDavide Franco <bacula-dev@dflc.ch>
Sun, 17 Jul 2011 20:01:45 +0000 (22:01 +0200)
committerKern Sibbald <kern@sibbald.com>
Sat, 20 Apr 2013 12:49:24 +0000 (14:49 +0200)
 - Removed TriggerDBError() function
 - Removed getResult() function
 - Removed old unused code

gui/bacula-web/includes/db/cdb.class.php

index 215b9a398a2c69c23c570a6c2601eece7c57a054..cb2cbc0c9e11bbfe987edb706a2ef1b4f610429e 100644 (file)
@@ -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 <br />$query");
+               if( !is_a( $this->result, 'CDBResult') )
+                       throw new PDOException("Failed to execute query <br />$query");
                
                if( !$this->result->execute() )
-                       throw new CDBError("Failed to execute query <br />$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 <br />$query");
+               
+               return $this->result;
        }
        
        public function countResult()
        {
                return $this->result_nb;
        }
-       
-       public function triggerError( $message, $db_error)
-       {
-               echo 'Error: ' . $message . '<br />';
-               echo 'Standard Message: ' . $db_error->getMessage() . '<br />';
-               echo 'Standard Code: ' . $db_error->getCode() . '<br />';
-               echo 'DBMS/User Message: ' . $db_error->getUserInfo() . '<br />';
-               echo 'DBMS/Debug Message: ' . $db_error->getDebugInfo() . '<br />';
-       }
 }
 ?>