Moved last exception thing to BaseDatabaseFrontend so it will become available for...
[core.git] / inc / classes / main / database / class_BaseDatabaseFrontend.php
index ffdd69cf57482ca89b35abb001a26386768977a2..820e4c3ab9b6d5a47f27ca88bd309a02b2781e0a 100644 (file)
@@ -31,6 +31,11 @@ abstract class BaseDatabaseFrontend extends BaseFrameworkSystem implements Datab
        const RESULT_INDEX_STATUS    = 'status';
        const RESULT_INDEX_EXCEPTION = 'exception';
 
+       /**
+        * Last thrown exception or NULL if all is fine
+        */
+       private $lastException = NULL;
+
        /**
         * Protected constructor
         *
@@ -41,6 +46,35 @@ abstract class BaseDatabaseFrontend extends BaseFrameworkSystem implements Datab
                // Call parent constructor
                parent::__construct($className);
        }
+
+       /**
+        * Getter for last exception
+        *
+        * @return      $lastException  Last thrown exception
+        */
+       public final function getLastException () {
+               return $this->lastException;
+       }
+
+       /**
+        * Setter for last exception
+        *
+        * @param       $lastException  Last thrown exception
+        * @return      void
+        */
+       public final function setLastException (FrameworkException $exceptionInstance) {
+               $this->lastException = $exceptionInstance;
+       }
+
+       /**
+        * Reset the last exception instance. This should be done after a "query"
+        * was completed without any errors.
+        *
+        * @return      void
+        */
+       protected final function resetLastException () {
+               $this->lastException = NULL;
+       }
 }
 
 // [EOF]