]> git.sur5r.net Git - bacula/bacula/blob - gui/bacula-web/includes/bweb.inc.php
0c186a9caa9ce440f348a67bc1819b99f63f980c
[bacula/bacula] / gui / bacula-web / includes / bweb.inc.php
1 <?php
2 /* 
3 +-------------------------------------------------------------------------+
4 | Copyright (C) 2004 Juan Luis Francés Jiménez                                                    |
5 | Copyright 2010-2011, Davide Franco                                              |
6 |                                                                         |
7 | This program is free software; you can redistribute it and/or           |
8 | modify it under the terms of the GNU General Public License             |
9 | as published by the Free Software Foundation; either version 2          |
10 | of the License, or (at your option) any later version.                  |
11 |                                                                         |
12 | This program is distributed in the hope that it will be useful,         |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of          |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the           |
15 | GNU General Public License for more details.                            |
16 +-------------------------------------------------------------------------+ 
17 */
18 class Bweb extends DB 
19 {
20     var         $driver;
21         
22         public  $tpl;
23         public  $db_link;                                               // Database link
24         
25         private $config_file;                                   // Config filename
26         private $config;                                                // Loaded config from bacula.conf
27         private $catalogs = array();                    // Catalog array
28         public  $catalog_nb;
29         private $catalog_current_id;
30         private $bwcfg;
31
32     function __construct()
33         {             
34                 $this->bwcfg = new Config();
35                 $dsn = array();
36                 
37                 // Loading configuration from config file
38                 $this->bwcfg->Load_Config();
39                 $this->catalog_nb = $this->bwcfg->Count_Catalogs();
40                 
41                 // Initialize smarty template classe
42                 $this->init_tpl();
43                 // Initialize smarty gettext function
44                 $this->init_gettext();
45                 
46                 // Check catalog id
47                 if( isset($_POST['catalog_id']) ) {
48                         $this->catalog_current_id = $_POST['catalog_id'];
49                         $_SESSION['catalog_id'] = $this->catalog_current_id;
50                 }
51                 elseif( isset( $_SESSION['catalog_id'] ) )
52                         $this->catalog_current_id = $_SESSION['catalog_id'];
53                 else {
54                         $this->catalog_current_id = 0;
55                         $_SESSION['catalog_id'] = $this->catalog_current_id;
56                 }
57
58                 $this->tpl->assign( 'catalog_current_id', $this->catalog_current_id );
59                 
60                 // Get DSN
61                 $dsn = $this->bwcfg->Get_Dsn( $this->catalog_current_id );
62 /*              
63                 // Connect to the database
64                 $options                = array( 'portability' => DB_PORTABILITY_ALL );
65                 $this->db_link  = $this->connect( $dsn, $options );
66 */
67                 // Database connection
68                 try {
69                         $this->db_link = new CDB(       $this->bwcfg->getDSN($this->catalog_current_id), 
70                                                                                 $this->bwcfg->getUser($this->catalog_current_id), 
71                                                                                 $this->bwcfg->getPwd($this->catalog_current_id)  );
72                         $this->db_link->makeConnection();
73                         
74         }catch( PDOException $e ) {
75                         CDBError::raiseError( $e );
76                 }               
77 /*              
78                 if (DB::isError($this->db_link)) {
79                         $this->TriggerDBError('Unable to connect to catalog', $this->db_link);
80                 }else {
81                         $this->driver = $dsn['phptype'];                            
82                         register_shutdown_function(array(&$this,'close') );
83                         $this->db_link->setFetchMode(DB_FETCHMODE_ASSOC);
84                 }
85 */
86                 // Catalog selection            
87                 if( $this->catalog_nb > 1 ) {
88                         // Catalogs list
89                         $this->tpl->assign( 'catalogs', $this->bwcfg->Get_Catalogs() );                 
90                         // Catalogs count
91                         $this->tpl->assign( 'catalog_nb', $this->catalog_nb );
92                 }
93         }
94                 
95     // Initialize Smarty template classe
96         function init_tpl()
97         {
98                 $this->tpl = new Smarty();
99                 
100                 $this->tpl->compile_check       = true;
101                 $this->tpl->debugging           = false;
102                 $this->tpl->force_compile       = true;
103
104                 $this->tpl->template_dir        = "./templates";
105                 $this->tpl->compile_dir         = "./templates_c";
106         }
107         
108         function init_gettext()
109         {
110                 global $smarty_gettext_path;
111                 
112                 if ( function_exists("gettext") ) {
113                         require_once( BW_SMARTY_GETTEXT . "smarty_gettext.php" );     
114                         $this->tpl->register_block('t','smarty_translate');
115         
116                         $language = $this->bwcfg->Get_Config_Param("lang");
117                         $domain = "messages";   
118                         putenv("LANG=$language"); 
119                         setlocale(LC_ALL, $language);
120                         bindtextdomain($domain,"./locale");
121                         textdomain($domain);
122                 }
123                 else {
124                         function smarty_translate($params, $text, &$smarty) {
125                 return $text;
126                         }
127                         $smarty->register_block('t','smarty_translate');
128                 }
129         }
130         
131         function close() 
132         {
133                 $this->db_link->disconnect();
134     }      
135        
136         function GetDbSize() 
137         {
138                 $db_size = 0;
139                 $query   = '';
140                 $result  = '';
141                 
142                 switch( $this->db_link->getDriver() )
143                 {
144                         case 'mysql':
145                                 $query  = "SELECT table_schema AS 'database', sum( data_length + index_length) AS 'dbsize' ";
146                                 $query .= "FROM information_schema.TABLES ";
147                                 $query .= "WHERE table_schema = 'bacula' ";
148                                 $query .= "GROUP BY table_schema";
149                         break;
150                         case 'pgsql':
151                                 $query  = "SELECT pg_database_size('bacula') AS dbsize";
152                         break;
153                         case 'sqlite':
154                                 // Not yet implemented
155                                 return "0 MB";
156                         break;
157                 }
158                 
159                 // Execute SQL statment
160                 try {
161                         $result  = $this->db_link->runQuery( $query );
162                         $db_size = $result->fetch();
163                         $db_size = CUtils::Get_Human_Size( $db_size['dbsize'] );
164                 }catch( PDOException $e) {
165                         CDBError::raiseError($e);
166                 }
167                 return $db_size;
168                 /*
169                 $result = $this->db_link->query( $query );
170                 
171                 if(! PEAR::isError( $result ) )
172                 {
173                         $db = $result->fetchRow();
174                         $database_size = $db['dbsize'];
175                 }else
176                         $this->TriggerDBError( 'Unable to get database size', $result);
177                 
178                 return CUtils::Get_Human_Size( $database_size );
179                 */
180         } // end function GetDbSize()
181         
182         public function Get_Nb_Clients()
183         {
184                 $result    = '';
185                 $clients_nb = 0;
186                 $query     = "SELECT COUNT(*) AS nb_client FROM Client";
187                 
188                 try {
189                         $clients    = $this->db_link->runQuery( $query );
190                         $clients_nb = $clients->fetch();
191                 }catch( PDOException $e ) {
192                         CDBError::raiseError( $e );
193                 }
194                 
195                 return $clients_nb;
196                 /*
197                 $clients = $this->db_link->query("SELECT COUNT(*) AS nb_client FROM Client");
198                 if( PEAR::isError($clients) )
199                         $this->TriggerDBError("Unable to get client number", $clients );
200                 else
201                         return $clients->fetchRow( DB_FETCHMODE_ASSOC );
202                 */
203         }
204   
205         // Return an array of volumes ordered by poolid and volume name
206         function GetVolumeList() 
207         {
208                         $pools        = '';
209                         $volumes      = '';
210                         $volumes_list = array();
211                         $query        = "";
212                         $debug        = false;
213                         
214                         // Get the list of pools id
215                         $query = "SELECT Pool.poolid, Pool.name FROM Pool ORDER BY Pool.poolid";
216                         
217                         try {
218                                 foreach( $this->getPools() as $pool ) {
219                                         switch( $this->db_link->getDriver() )
220                                         {
221                                                 case 'sqlite':
222                                                 case 'mysql':
223                                                         $query  = "SELECT Media.volumename, Media.volbytes, Media.volstatus, Media.mediatype, Media.lastwritten, Media.volretention
224                                                                         FROM Media LEFT JOIN Pool ON Media.poolid = Pool.poolid
225                                                                         WHERE Media.poolid = '". $pool['poolid'] . "' ORDER BY Media.volumename";
226                                                 break;
227                                                 case 'pgsql':
228                                                         $query  = "SELECT media.volumename, media.volbytes, media.volstatus, media.mediatype, media.lastwritten, media.volretention
229                                                                         FROM media LEFT JOIN pool ON media.poolid = pool.poolid
230                                                                     WHERE media.poolid = '". $pool['poolid'] . "' ORDER BY media.volumename";
231                                                 break;
232                                         } // end switch
233                                         
234                                         $volumes = $this->db_link->runQuery($query);
235                                 
236                                         if( !array_key_exists( $pool['name'], $volumes_list) )
237                                                 $volumes_list[ $pool['name'] ] = array();
238                                         
239                                         foreach( $volumes->fetchAll() as $volume ) {
240                                                 if( $volume['lastwritten'] != "0000-00-00 00:00:00" ) {
241                                                         
242                                                         // Calculate expiration date if the volume is Full
243                                                         if( $volume['volstatus'] == 'Full' ) {
244                                                                 $expire_date     = strtotime($volume['lastwritten']) + $volume['volretention'];
245                                                                 $volume['expire'] = strftime("%Y-%m-%d", $expire_date);
246                                                         }else {
247                                                                 $volume['expire'] = 'N/A';
248                                                         }
249                                                         
250                                                         // Media used bytes in a human format
251                                                         $volume['volbytes'] = CUtils::Get_Human_Size( $volume['volbytes'] );
252                                                 } else {
253                                                         $volume['lastwritten'] = "N/A";
254                                                         $volume['expire']      = "N/A";
255                                                         $volume['volbytes']       = "0 KB";
256                                                 }
257                                                 
258                                                 // Odd or even row
259                                                 if( count(  $volumes_list[ $pool['name'] ] ) % 2)
260                                                         $volume['class'] = 'odd';
261
262                                                 // Add the media in pool array
263                                                 array_push( $volumes_list[ $pool['name']], $volume);
264                                         } // end foreach volumes
265                                 } // end foreach pools
266                                 
267                         }catch(PDOException $e) {
268                                 CDBError::raiseError($e);
269                         }
270                         
271                         return $volumes_list;
272                         /*
273                         $pools = $this->db_link->query( $query );
274                         
275                         if( PEAR::isError( $pools ) )
276                                 $this->TriggerDBError("Failed to get pool list", $pools );
277
278                         
279                         while( $pool = $pools->fetchRow( DB_FETCHMODE_ASSOC ) ) {
280                                 switch( $this->db_link->getDriver() )
281                                 {
282                                         case 'mysql':
283                                                 $query  = "SELECT Media.volumename, Media.volbytes, Media.volstatus, Media.mediatype, Media.lastwritten, Media.volretention
284                                                                    FROM Media LEFT JOIN Pool ON Media.poolid = Pool.poolid
285                                                                    WHERE Media.poolid = '". $pool['poolid'] . "' ORDER BY Media.volumename";
286                                         break;
287                                         case 'pgsql':
288                                                 $query  = "SELECT media.volumename, media.volbytes, media.volstatus, media.mediatype, media.lastwritten, media.volretention
289                                                                    FROM media LEFT JOIN pool ON media.poolid = pool.poolid
290                                                                    WHERE media.poolid = '". $pool['poolid'] . "' ORDER BY media.volumename";
291                                         break;
292                                         case 'sqlite':
293                                                 $query  = "";           // not yet implemented
294                                         break;
295                                         default:
296                                         break;
297                                 } // end switch
298                                 
299                                 $medias = $this->db_link->query( $query );
300
301                                 if( PEAR::isError( $medias ) ) {
302                                         $this->TriggerDBError("Failed to get media list for pool", $medias);
303                                 }else {
304                                         if( $debug ) echo "Found " . $medias->numRows() . " medias for pool " . $pool['name'] . " <br />";
305                                 
306                                         // Create array key for each pool
307                                         if( !array_key_exists( $pool['name'], $volumes) )
308                                         {
309                                                 $volumes[ $pool['name'] ] = array();
310                                         }
311                                         while( $media = $medias->fetchRow( DB_FETCHMODE_ASSOC ) ) {
312                                                 if( $debug ) {
313                                                         var_dump( $media );
314                                                 }
315                                                 // If the pool is empty (no volumes in this pool)
316                                                 if( $medias->numRows() == 0 ) {
317                                                         if( $debug ) echo "No media in pool " . $pool['name'] . "<br />";
318                                                 } else {
319                                                                 if( $media['lastwritten'] != "0000-00-00 00:00:00" ) {
320                                                                         // Calculate expiration date if the volume is Full
321                                                                         if( $media['volstatus'] == 'Full' ) {
322                                                                                 $expire_date     = strtotime($media['lastwritten']) + $media['volretention'];
323                                                                                 $media['expire'] = strftime("%Y-%m-%d", $expire_date);
324                                                                         }else {
325                                                                                 $media['expire'] = 'N/A';
326                                                                         }
327                                                                         // Media used bytes in a human format
328                                                                         $media['volbytes'] = CUtils::Get_Human_Size( $media['volbytes'] );
329                                                                 } else {
330                                                                         $media['lastwritten'] = "N/A";
331                                                                         $media['expire']      = "N/A";
332                                                                         $media['volbytes']        = "0 KB";
333                                                                 }                                                               
334                                                         
335                                                         // Odd or even row
336                                                         if( count(  $volumes[ $pool['name'] ] ) % 2)
337                                                                         $media['class'] = 'odd';
338
339                                                         // Add the media in pool array
340                                                         array_push( $volumes[ $pool['name']], $media);
341                                                 }
342                                         } // end while
343                                 } // end if else
344                         } // end while
345                         
346                         */
347
348         } // end function GetVolumeList()
349         
350         public function countJobs( $start_timestamp, $end_timestamp, $status = 'ALL', $level = 'ALL', $jobname = 'ALL', $client = 'ALL' )
351         {
352                 $query                    = "";
353                 $where_interval   = "";
354                 $where_conditions = array();
355                 $result                   = '';
356                 
357                 // Calculate sql query interval
358                 $start_date             = date( "Y-m-d H:i:s", $start_timestamp);       
359                 $end_date               = date( "Y-m-d H:i:s", $end_timestamp);
360                 
361                 switch( $this->db_link->getDriver() )
362                 {
363                         case 'sqlite':
364                         case 'mysql':
365                                 $query                 .= "SELECT COUNT(*) AS job_nb FROM Job ";
366                                 $where_conditions[] = "(EndTime BETWEEN '$start_date' AND '$end_date')";
367                         break;
368                         case 'pgsql':
369                                 $query             .= "SELECT COUNT(*) AS job_nb FROM job ";
370                                 $where_conditions[] = "(EndTime BETWEEN timestamp '$start_date' AND timestamp '$end_date')";
371                         break;
372                 }
373                 
374                 if( $status != 'ALL' ) {
375                         switch( strtolower($status) )
376                         {
377                                 case 'running':
378                                         array_pop( $where_conditions );
379                                         $where_conditions[] = "JobStatus = 'R' ";
380                                 break;
381                                 case 'completed':
382                                         $where_conditions[] = "JobStatus = 'T' ";
383                                 break;
384                                 case 'failed':
385                                         $where_conditions[] = "JobStatus IN ('f','E') ";
386                                 break;
387                                 case 'canceled':
388                                         $where_conditions[] = "JobStatus = 'A' ";
389                                 break;
390                                 case 'waiting':
391                                         array_pop( $where_conditions );
392                                         $where_conditions[] = "Job.JobStatus IN ('F','S','M','m','s','j','c','d','t','p','C') ";
393                                 break;
394                         } // end switch
395                 }
396                 
397                 // Filter by status
398                 if( $level != 'ALL' )
399                         $where_conditions[] = "Level = '$level' ";
400                 
401                 // Construct SQL query
402                 foreach( $where_conditions as $k => $condition ) {
403                         if( $k == 0) {
404                                 $query .= "WHERE $condition ";
405                         }else
406                                 $query .= "AND $condition ";
407                 }
408                 
409                 // Execute the query
410                 try{
411                         $jobs   = $this->db_link->runQuery($query);
412                         $result = $jobs->fetch(); 
413                 }catch(PDOException $e) {
414                         CDBError::raiseError($e);
415                 }
416                 
417                 return $result['job_nb'];
418                 /*
419                 $jobs = $this->db_link->query( $query );
420         
421                 if (!PEAR::isError( $jobs ) ) {
422                         $jobs = $jobs->fetchRow(); 
423                         return $jobs['job_nb'];
424                 }
425                 
426                 $this->TriggerDBError("Unable to get last $status jobs number from catalog", $jobs);
427                 */
428         }
429         
430         // Return the list of Pools in a array
431         public function getPools()
432         {
433                 $pools  = array();
434                 $result = '';
435                 
436                 switch( $this->db_link->getDriver() )
437                 {
438                         case 'sqlite':
439                         case 'mysql':
440                                 $query          = "SELECT name, poolid FROM Pool";
441                         break;
442                         case 'pgsql':
443                                 $query          = "SELECT name, poolid FROM pool";
444                         break;
445                 }
446                 try{
447                         $result = $this->db_link->runQuery($query);
448                         foreach( $result->fetchAll() as $pool )
449                                 $pools[] = $pool;
450                 }catch(PDOException $e) {
451                         CDBError::raiseError($e);
452                 }
453
454                 return $pools;
455                 /*
456                 $result         = $this->db_link->query ( $query );
457
458                 if( !PEAR::isError( $result ) ) {
459                         while( $pool = $result->fetchRow() )
460                                 $pools[] = $pool;
461                         return $pools;
462                 }
463                 $this->TriggerDBError( "Unable to get the pool list from catalog", $result );           
464                 */
465         }
466         
467         public function Get_BackupJob_Names()
468         {
469                 $query          = '';
470                 $result         = '';
471                 $backupjobs = array();
472                 
473                 switch( $this->db_link->getDriver() )
474                 {
475                         case 'sqlite':
476                         case 'mysql':
477                                 $query          = "SELECT name FROM Job GROUP BY name ORDER BY name";
478                         break;
479                         case 'pgsql':
480                                 $query          = "SELECT name FROM Job GROUP BY name ORDER BY name";
481                         break;
482                 }
483                 try {
484                         $result = $this->db_link->runQuery($query);
485                         foreach( $result->fetchAll() as $jobname )
486                                 $backupjobs[] = $jobname['name'];
487                 }catch(PDOException $e) {
488                         CDBError::raiseError($e);
489                 }
490
491                 return $backupjobs;
492                 /*
493                 $result = $this->db_link->query( $query );
494                 
495                 if (PEAR::isError( $result ) ) {
496                         $this->TriggerDBError("Unable to get BackupJobs list from catalog", $result );
497                 }else{
498                         while( $backupjob = $result->fetchRow() ) {
499                                 array_push( $backupjobs, $backupjob["name"] );
500                         }
501                         return $backupjobs;
502                 }
503                 */
504         }
505         
506         public function countVolumes( $pool_id = 'ALL' )
507         {
508                 $result = null;
509                 $nb_vol = null;
510                 $query  = '';
511
512                 switch( $this->db_link->getDriver() )
513                 {
514                         case 'sqlite':
515                         case 'mysql':
516                                 $query  = 'SELECT COUNT(*) as vols_count ';
517                                 $query .= 'FROM Media ';
518                                 if( $pool_id != 'ALL' )
519                                         $query .= ' WHERE Media.poolid = ' . $pool_id;
520                         break;
521                         case 'pgsql':
522                                 $query  = 'SELECT COUNT(*) as vols_count ';
523                                 $query .= 'FROM Media ';
524                                 if( $pool_id != 'ALL' )
525                                         $query .= ' WHERE media.poolid = ' . $pool_id;
526                         break;
527                 }
528                 
529                 // Execute sql query
530                 try {
531                         $result = $this->db_link->runQuery($query);
532                         $vols = $result->fetch();
533                 }catch( PDOException $e) {
534                         CDBError::raiseError($e);
535                 }
536                 
537                 return $vols['vols_count'];
538                 /*
539                 $res = $this->db_link->query( $query );
540                 
541                 if( !PEAR::isError( $res ) ) {
542                         $vols = $res->fetchRow( );
543                         return $vols['vols_count'];
544                 }       
545                 $this->triggerDBError( 'Unable to get volume number from pool', $res );
546                 */
547         }
548         
549         public function getStoredFiles( $start_timestamp, $end_timestamp, $job_name = 'ALL' )
550         {
551                 $query = "";
552                 $start_date = date( "Y-m-d H:i:s", $start_timestamp);   
553                 $end_date   = date( "Y-m-d H:i:s", $end_timestamp);     
554                 
555                 switch( $this->db_link->getDriver() )
556                 {
557                         case 'sqlite':
558                         case 'mysql':
559                                         $query = "SELECT SUM(JobFiles) AS stored_files FROM Job ";
560                                         $query .= "WHERE ( EndTime BETWEEN '$start_date' AND '$end_date' )";
561                         break;
562                         case 'pgsql':
563                                         $query = "SELECT SUM(JobFiles) AS stored_files FROM job ";
564                                         $query .= "WHERE ( endtime BETWEEN timestamp '$start_date' AND timestamp '$end_date' )";
565                         break;
566                 }
567                 
568                 if( $job_name != 'ALL' ) 
569                         $query .= " AND name = '$job_name'";
570                 
571                 // Execute query
572                 try {
573                         $result = $this->db_link->runQuery( $query );
574                         $result = $result->fetch();
575                 }catch( PDOException $e) {
576                         CDBError::raiseError($e);
577                 }
578                 
579                 if( isset($result['stored_files']) and !empty($result['stored_files']) )
580                         return $result['stored_files'];
581                 else
582                         return 0;
583                 /*
584                 $result = $this->db_link->query( $query );
585                 
586                 if( !PEAR::isError($result) ) {
587                         $result = $result->fetchRow();
588                         
589                         if( isset($result['stored_files']) and !empty($result['stored_files']) )
590                                 return $result['stored_files'];
591                         else
592                                 return 0;
593                 }else{
594                         $this->TriggerDBError("Unable to get protected files from catalog", $result);
595                 }
596                 */
597         }
598         
599         // Function: getStoredBytes
600         // Parameters:
601         //              $start_timestamp:       start date in unix timestamp format
602         //              $end_timestamp:         end date in unix timestamp format
603         //              $job_name:                      optional job name
604         
605         public function getStoredBytes( $start_timestamp, $end_timestamp, $job_name = 'ALL' )
606         {
607                 $query                  = '';
608                 $result                 = '';
609                 $start_date             = date( "Y-m-d H:i:s", $start_timestamp);       
610                 $end_date               = date( "Y-m-d H:i:s", $end_timestamp); 
611                 
612                 switch( $this->db_link->getDriver() )
613                 {
614                         case 'sqlite':
615                         case 'mysql':
616                                 $query  = "SELECT SUM(JobBytes) as stored_bytes FROM Job ";
617                                 $query .= "WHERE ( EndTime BETWEEN '$start_date' AND '$end_date' )";
618                         break;
619                         case 'pgsql':
620                                 $query  = "SELECT SUM(jobbytes) as stored_bytes FROM job ";
621                                 $query .= "WHERE ( endtime BETWEEN timestamp '$start_date' AND timestamp '$end_date' )";
622                         break;
623                 }
624
625                 if( $job_name != 'ALL' ) 
626                         $query .= " AND name = '$job_name'";
627                 
628                 // Execute SQL statment
629                 try {
630                         $result = $this->db_link->runQuery( $query );
631                         $result = $result->fetch();
632                 }catch(PDOException $e) {
633                         CDBError::raiseError( $e );
634                 }
635                 
636                 if( isset($result['stored_bytes']) and !empty($result['stored_bytes']) )
637                         return $result['stored_bytes'];
638                 else
639                         return 0;
640                 /*
641                 $result = $this->db_link->query( $query );
642                 
643                 // Testing query result
644                 if( PEAR::isError( $result ) ) {
645                         $this->TriggerDBError("Unable to get Job Bytes from catalog", $result );
646                 }else{
647                         $result = $result->fetchRow();
648                         
649                         if( !PEAR::isError($result) ) {
650                                 if( isset($result['stored_bytes']) and !empty($result['stored_bytes']) )
651                                         return $result['stored_bytes'];
652                                 else
653                                         return 0;
654                         }else
655                                 $this->TriggerDBError( "Error fetching query result", $result);
656                 }
657                 */
658         }
659         
660         public function TriggerDBError( $message, $db_error)
661         {
662                 echo 'Error: ' . $message . '<br />';
663                 echo 'Standard Message: ' . $db_error->getMessage() . '<br />';
664                 echo 'Standard Code: ' . $db_error->getCode() . '<br />';
665                 echo 'DBMS/User Message: ' . $db_error->getUserInfo() . '<br />';
666                 echo 'DBMS/Debug Message: ' . $db_error->getDebugInfo() . '<br />';
667                 exit;
668         }
669 } // end class Bweb
670 ?>