]> git.mxchange.org Git - core.git/blobdiff - inc/classes/main/result/class_DatabaseResult.php
Some 'static' array elements rewritten to constant, other cleanups
[core.git] / inc / classes / main / result / class_DatabaseResult.php
index e2505df0d50fd1000ccb5d1379fd5fd696c3ec02..0d3f8180dcb10e2275f373a1e7a78efbe710ee7b 100644 (file)
@@ -79,6 +79,9 @@ class DatabaseResult extends BaseFrameworkSystem implements SearchableResult, Up
                // Set the result array
                $resultInstance->setResultArray($resultArray);
 
                // Set the result array
                $resultInstance->setResultArray($resultArray);
 
+               // Set affected rows
+               $resultInstance->setAffectedRows(count($resultArray[BaseDatabaseFrontend::RESULT_INDEX_ROWS]));
+
                // Return the instance
                return $resultInstance;
        }
                // Return the instance
                return $resultInstance;
        }
@@ -106,7 +109,7 @@ class DatabaseResult extends BaseFrameworkSystem implements SearchableResult, Up
                // Now get the update criteria array and update all entries
                foreach ($updateInstance->getUpdateCriteria() as $criteriaKey => $criteriaValue) {
                        // Update data
                // Now get the update criteria array and update all entries
                foreach ($updateInstance->getUpdateCriteria() as $criteriaKey => $criteriaValue) {
                        // Update data
-                       $this->resultArray['rows'][$entryKey][$criteriaKey] = $criteriaValue;
+                       $this->resultArray[BaseDatabaseFrontend::RESULT_INDEX_ROWS][$entryKey][$criteriaKey] = $criteriaValue;
 
                        // Mark it as out-dated
                        $this->outDated[$criteriaKey] = 1;
 
                        // Mark it as out-dated
                        $this->outDated[$criteriaKey] = 1;
@@ -127,7 +130,7 @@ class DatabaseResult extends BaseFrameworkSystem implements SearchableResult, Up
                if ($this->valid()) {
                        // Next entry found, so count one up and cache it
                        $this->currentPos++;
                if ($this->valid()) {
                        // Next entry found, so count one up and cache it
                        $this->currentPos++;
-                       $this->currentRow = $this->resultArray['rows'][$this->currentPos];
+                       $this->currentRow = $this->resultArray[BaseDatabaseFrontend::RESULT_INDEX_ROWS][$this->currentPos];
                        $nextValid = true;
                } // END - if
 
                        $nextValid = true;
                } // END - if
 
@@ -162,9 +165,9 @@ class DatabaseResult extends BaseFrameworkSystem implements SearchableResult, Up
                $current = NULL;
 
                // Does the current enty exist?
                $current = NULL;
 
                // Does the current enty exist?
-               if (isset($this->resultArray['rows'][$this->currentPos])) {
+               if (isset($this->resultArray[BaseDatabaseFrontend::RESULT_INDEX_ROWS][$this->currentPos])) {
                        // Then get it
                        // Then get it
-                       $current = $this->resultArray['rows'][$this->currentPos];
+                       $current = $this->resultArray[BaseDatabaseFrontend::RESULT_INDEX_ROWS][$this->currentPos];
                } // END - if
 
                // Return the result
                } // END - if
 
                // Return the result
@@ -181,7 +184,7 @@ class DatabaseResult extends BaseFrameworkSystem implements SearchableResult, Up
                $isValid = false;
 
                // Check if 
                $isValid = false;
 
                // Check if 
-               if (($this->ifStatusIsOkay()) && (isset($this->resultArray['rows'][($this->currentPos + 1)])) && (isset($this->resultArray['rows'][0]))) {
+               if (($this->ifStatusIsOkay()) && (isset($this->resultArray[BaseDatabaseFrontend::RESULT_INDEX_ROWS][($this->currentPos + 1)])) && (isset($this->resultArray[BaseDatabaseFrontend::RESULT_INDEX_ROWS][0]))) {
                        // All fine!
                        $isValid = true;
                } // END - if
                        // All fine!
                        $isValid = true;
                } // END - if
@@ -196,7 +199,7 @@ class DatabaseResult extends BaseFrameworkSystem implements SearchableResult, Up
         * @return      $ifStatusOkay   Wether the status of the query was okay
         */
        public function ifStatusIsOkay () {
         * @return      $ifStatusOkay   Wether the status of the query was okay
         */
        public function ifStatusIsOkay () {
-               return ((isset($this->resultArray['status'])) && ($this->resultArray['status'] === LocalfileDatabase::RESULT_OKAY));
+               return ((isset($this->resultArray[BaseDatabaseFrontend::RESULT_INDEX_STATUS])) && ($this->resultArray[BaseDatabaseFrontend::RESULT_INDEX_STATUS] === LocalfileDatabase::RESULT_OKAY));
        }
 
        /**
        }
 
        /**
@@ -226,7 +229,7 @@ class DatabaseResult extends BaseFrameworkSystem implements SearchableResult, Up
         * @todo        0% done
         */
        public function searchEntry (LocalSearchCriteria $criteriaInstance) {
         * @todo        0% done
         */
        public function searchEntry (LocalSearchCriteria $criteriaInstance) {
-               die(__METHOD__.": Unfinished!");
+               die(__METHOD__.': Unfinished!');
        }
 
        /**
        }
 
        /**