generateUniqueId() and more useless/deprecated methods removed, code speed-up, link...
[shipsimu.git] / inc / classes / main / result / class_DatabaseResult.php
index 45412dc90f34ea45191e114f2bc7c906dca755c9..694f13aca7bb5e9f28e18a05b3ebc4ae591a095a 100644 (file)
@@ -60,12 +60,6 @@ class DatabaseResult extends BaseFrameworkSystem implements SearchableResult, Up
                // Call parent constructor
                parent::__construct(__CLASS__);
 
-               // Set part description
-               $this->setObjectDescription("Database result");
-
-               // Create unique ID number
-               $this->generateUniqueId();
-
                // Clean up a little
                $this->removeNumberFormaters();
                $this->removeSystemArray();
@@ -129,14 +123,11 @@ class DatabaseResult extends BaseFrameworkSystem implements SearchableResult, Up
                $nextValid = false;
 
                // Is the result valid?
-               if ($this->resultArray['status'] === "ok") {
-                       // The status is fine so let's have a look for the next entry
-                       if ($this->valid()) {
-                               // Next entry found, so count one up and cache it
-                               $this->currentPos++;
-                               $this->currentRow = $this->resultArray['rows'][$this->currentPos];
-                               $nextValid = true;
-                       } // END - if
+               if ($this->valid()) {
+                       // Next entry found, so count one up and cache it
+                       $this->currentPos++;
+                       $this->currentRow = $this->resultArray['rows'][$this->currentPos];
+                       $nextValid = true;
                } // END - if
 
                // Return the result
@@ -189,7 +180,7 @@ class DatabaseResult extends BaseFrameworkSystem implements SearchableResult, Up
                $isValid = false;
 
                // Check if 
-               if ((isset($this->resultArray['rows'][($this->currentPos + 1)])) && (isset($this->resultArray['rows'][0]))) {
+               if (($this->ifStatusIsOkay()) && (isset($this->resultArray['rows'][($this->currentPos + 1)])) && (isset($this->resultArray['rows'][0]))) {
                        // All fine!
                        $isValid = true;
                } // END - if
@@ -198,6 +189,15 @@ class DatabaseResult extends BaseFrameworkSystem implements SearchableResult, Up
                return $isValid;
        }
 
+       /**
+        * Determines wether the status of the query was fine ("ok")
+        *
+        * @return      $ifStatusOkay   Wether the status of the query was okay
+        */
+       public function ifStatusIsOkay () {
+               return ((isset($this->resultArray['status'])) && ($this->resultArray['status'] === "ok"));
+       }
+
        /**
         * Gets the current key of iteration
         *