Database result added, SqlException added
[shipsimu.git] / inc / classes / main / database / wrapper / class_UserDatabaseWrapper.php
index c8eb465c2b3e313b29cb753dae071d0b832708f3..a9f64d8c0b54c40ad49e6d5225785485fffab231 100644 (file)
@@ -103,8 +103,17 @@ class UserDatabaseWrapper extends BaseDatabaseWrapper {
                        // Now it's time to ask the database layer for this select statement
                        $result = $this->getDatabaseInstance()->doSelectByTableCriteria(self::DB_TABLE_USER, $criteriaInstance);
 
-                       // Cache the result
-                       $this->cacheInstance->offsetSet($cacheKey, $result);
+                       // Cache the result if not null
+                       if (!is_null($result)) {
+                               // A valid result has returned from the database layer
+                               $this->cacheInstance->offsetSet($cacheKey, $result);
+                       } else {
+                               // This invalid result must be wrapped
+                               $result = array(
+                                       'status'                => "invalid",
+                                       'exception'             => $this->getDatabaseInstance()->getLastException()
+                               );
+                       }
                }
 
                // Create an instance of a DatabaseResult class with the given result