]> git.sur5r.net Git - bacula/bacula/commitdiff
bacula-web: New classes files CDBError and CDBResult in includes/db
authorDavide Franco <bacula-dev@dflc.ch>
Fri, 15 Jul 2011 13:58:36 +0000 (15:58 +0200)
committerKern Sibbald <kern@sibbald.com>
Sat, 20 Apr 2013 12:49:24 +0000 (14:49 +0200)
gui/bacula-web/includes/db/cdberror.class.php [new file with mode: 0644]
gui/bacula-web/includes/db/cdbresult.class.php [new file with mode: 0644]

diff --git a/gui/bacula-web/includes/db/cdberror.class.php b/gui/bacula-web/includes/db/cdberror.class.php
new file mode 100644 (file)
index 0000000..d3ea390
--- /dev/null
@@ -0,0 +1,24 @@
+<?php
+
+class CDBError extends Exception
+{
+       public function __construct( $message, $debug = false )
+       {
+               $this->debug_level      = $debug;
+               $this->message          = $message;
+               
+               $this->raiseError();
+               die();
+       }
+       
+       public function raiseError()
+       {
+               echo '<h3>Dabase error: </h3>';
+               echo 'Message: ' . $this->getMessage() . '<br />';
+               echo 'Code: ' . $this->getCode()  . '<br />';
+               echo 'Line: ' . $this->getLine()  . '<br />';
+               echo 'File: ' . $this->getFile() . '<br />';
+       }
+}
+
+?>
\ No newline at end of file
diff --git a/gui/bacula-web/includes/db/cdbresult.class.php b/gui/bacula-web/includes/db/cdbresult.class.php
new file mode 100644 (file)
index 0000000..1d6a673
--- /dev/null
@@ -0,0 +1,11 @@
+<?php
+
+class CDBResult extends PDOStatement
+{
+    protected function __construct()
+    {
+               $this->setFetchMode( PDO::FETCH_ASSOC );
+       }
+}
+
+?>
\ No newline at end of file