]> git.mxchange.org Git - core.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Thu, 21 Aug 2025 21:54:25 +0000 (23:54 +0200)
committerRoland Häder <roland@mxchange.org>
Thu, 21 Aug 2025 21:54:25 +0000 (23:54 +0200)
- added more type-hints
- moved constants from BaseDatabaseResult to SearchableResult

framework/main/classes/class_BaseFrameworkSystem.php
framework/main/classes/database/backend/lfdb_legacy/class_CachedLocalFileDatabase.php
framework/main/classes/database/class_BaseDatabaseResult.php
framework/main/classes/database/frontend/class_BaseDatabaseFrontend.php
framework/main/classes/database/migration/format_upgrade/class_
framework/main/classes/database/result/class_CachedDatabaseResult.php
framework/main/interfaces/result/class_SearchableResult.php
framework/main/middleware/database/class_DatabaseConnection.php

index a8d65bed956113c33f55aebfaea0b75c31f6e61b..60c9519a794d944259d7bc8c1179a3e925abe433 100644 (file)
@@ -720,7 +720,7 @@ Loaded includes:
                // Do we have an entry?
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('BASE-FRAMEWORK-SYSTEM: this->resultInstance->isValid()=%d', intval($this->getResultInstance()->isValid())));
                if ($this->getResultInstance()->valid() === false) {
-                       // @TODO Move the constant to e.g. BaseDatabaseResult when there is a non-cached database result available
+                       // @TODO Move the constant to e.g. SearchableResult when there is a non-cached database result available
                        throw new InvalidDatabaseResultException(array($this, $this->getResultInstance()), CachedDatabaseResult::EXCEPTION_INVALID_DATABASE_RESULT);
                }
 
index d693aced24a80183f8461fa81d9bef69c3da9c61..b0043b3070b6bc47bad1ff556c0d0cc0d0918797 100644 (file)
@@ -15,7 +15,7 @@ use Org\Mxchange\CoreFramework\Factory\Object\ObjectFactory;
 use Org\Mxchange\CoreFramework\Filesystem\FileNotFoundException;
 use Org\Mxchange\CoreFramework\Generic\FrameworkException;
 use Org\Mxchange\CoreFramework\Generic\FrameworkInterface;
-use Org\Mxchange\CoreFramework\Result\Database\BaseDatabaseResult;
+use Org\Mxchange\CoreFramework\Result\Search\SearchableResult;
 use Org\Mxchange\CoreFramework\Traits\Compressor\Channel\CompressorChannelTrait;
 use Org\Mxchange\CoreFramework\Traits\Handler\Io\IoHandlerTrait;
 
@@ -420,9 +420,9 @@ class CachedLocalFileDatabase extends BaseDatabaseBackend implements DatabaseBac
 
                        // Initialize the result data, this need to be rewritten e.g. if a local file cannot be read
                        $resultData = [
-                               BaseDatabaseResult::RESULT_NAME_STATUS    => self::RESULT_OKAY,
-                               BaseDatabaseResult::RESULT_NAME_ROWS      => [],
-                               BaseDatabaseResult::RESULT_NAME_EXCEPTION => NULL,
+                               SearchableResult::RESULT_NAME_STATUS    => self::RESULT_OKAY,
+                               SearchableResult::RESULT_NAME_ROWS      => [],
+                               SearchableResult::RESULT_NAME_EXCEPTION => NULL,
                        ];
 
                        // Initialize limit/skip
@@ -474,10 +474,10 @@ class CachedLocalFileDatabase extends BaseDatabaseBackend implements DatabaseBac
                                                $dataArray[$this->getIndexKey()] = $idx;
 
                                                // Entry found!
-                                               array_push($resultData[BaseDatabaseResult::RESULT_NAME_ROWS], $dataArray);
+                                               array_push($resultData[SearchableResult::RESULT_NAME_ROWS], $dataArray);
 
                                                // Count found entries up
-                                               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('CACHED-LOCAL-FILE-DATABASE: resultData[%s]()=%d', BaseDatabaseResult::RESULT_NAME_ROWS, count($resultData[BaseDatabaseResult::RESULT_NAME_ROWS])));
+                                               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('CACHED-LOCAL-FILE-DATABASE: resultData[%s]()=%d', SearchableResult::RESULT_NAME_ROWS, count($resultData[SearchableResult::RESULT_NAME_ROWS])));
                                                $limitFound++;
                                        }
                                } else {
index 69cf36b2fefe18f81eb43b3706af834b4ad88645..6e093ae630a5d4033650e6d7fedcc84dfb12ae65 100644 (file)
@@ -30,10 +30,6 @@ use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem;
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 abstract class BaseDatabaseResult extends BaseFrameworkSystem {
-       // Result array names
-       const RESULT_NAME_ROWS      = 'rows';
-       const RESULT_NAME_STATUS    = 'status';
-       const RESULT_NAME_EXCEPTION = 'exception';
 
        /**
         * Update criteria instance
@@ -56,7 +52,7 @@ abstract class BaseDatabaseResult extends BaseFrameworkSystem {
         * @param       $updateInstance         An instance of a LocalUpdateCriteria clase
         * @return      void
         */
-       public final function setUpdateInstance (LocalUpdateCriteria $updateInstance) {
+       public final function setUpdateInstance (LocalUpdateCriteria $updateInstance): void {
                $this->updateInstance = $updateInstance;
        }
 
@@ -65,7 +61,7 @@ abstract class BaseDatabaseResult extends BaseFrameworkSystem {
         *
         * @return      $updateInstance         Updateable criteria instance
         */
-       public final function getUpdateInstance () {
+       public final function getUpdateInstance (): LocalUpdateCriteria {
                return $this->updateInstance;
        }
 
index 525b7efca7800df85063c588e13c5dcef793ea5f..a77c54bca3f704d596cbecb6f87728f3809a3baa 100644 (file)
@@ -9,7 +9,7 @@ use Org\Mxchange\CoreFramework\Criteria\Storing\StoreableCriteria;
 use Org\Mxchange\CoreFramework\Database\Backend\BaseDatabaseBackend;
 use Org\Mxchange\CoreFramework\Factory\Object\ObjectFactory;
 use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem;
-use Org\Mxchange\CoreFramework\Result\Database\BaseDatabaseResult;
+use Org\Mxchange\CoreFramework\Result\Search\SearchableResult;
 use Org\Mxchange\CoreFramework\Traits\Cache\CacheableTrait;
 
 // Import SPL stuff
@@ -74,7 +74,7 @@ abstract class BaseDatabaseFrontend extends BaseFrameworkSystem {
         *
         * @return      void
         */
-       private function initCacheInstance () {
+       private function initCacheInstance (): void {
                // Set "cache" attributes
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('BASE-DATABASE-FRONTEND: CALLED!');
                $this->databaseCacheEnabled = FrameworkBootstrap::getConfigurationInstance()->isEnabled('database_cache');
@@ -96,7 +96,7 @@ abstract class BaseDatabaseFrontend extends BaseFrameworkSystem {
         * @param       $tableName      Name of table name to set
         * @return      void
         */
-       protected final function setTableName (string $tableName) {
+       protected final function setTableName (string $tableName): void {
                $this->tableName = $tableName;
        }
 
@@ -105,7 +105,7 @@ abstract class BaseDatabaseFrontend extends BaseFrameworkSystem {
         *
         * @return      $tableName      Name of table name to set
         */
-       protected final function getTableName () {
+       protected final function getTableName (): string {
                return $this->tableName;
        }
 
@@ -116,7 +116,7 @@ abstract class BaseDatabaseFrontend extends BaseFrameworkSystem {
         * @param       $onlyKeys                       Only use these keys for a cache key
         * @return      $cacheKey                       A cache key suitable for lookup/storage purposes
         */
-       protected function getCacheKeyByCriteria (Criteria $criteriaInstance, array $onlyKeys = []) {
+       protected function getCacheKeyByCriteria (Criteria $criteriaInstance, array $onlyKeys = []): string {
                // Generate it
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-DATABASE-FRONTEND: criteriaInstance=%s,onlyKeys()=%d - CALLED!', $criteriaInstance->__toString(), count($onlyKeys)));
                $cacheKey = sprintf('%s@%s',
@@ -136,7 +136,7 @@ abstract class BaseDatabaseFrontend extends BaseFrameworkSystem {
         * @param       $onlyKeys                       Only use these keys for a cache key
         * @return      void
         */
-       protected function queryInsertDataSet (StoreableCriteria $dataSetInstance, array $onlyKeys = []) {
+       protected function queryInsertDataSet (StoreableCriteria $dataSetInstance, array $onlyKeys = []): void {
                // Default cache key is NULL
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-DATABASE-FRONTEND: dataSetInstance=%s,onlyKeys()=%d - CALLED!', $dataSetInstance->__toString(), count($onlyKeys)));
                $cacheKey = NULL;
@@ -171,7 +171,7 @@ abstract class BaseDatabaseFrontend extends BaseFrameworkSystem {
         * @param       $onlyKeys                       Only use these keys for a cache key
         * @return      void
         */
-       protected function queryUpdateDataSet (StoreableCriteria $dataSetInstance, array $onlyKeys = []) {
+       protected function queryUpdateDataSet (StoreableCriteria $dataSetInstance, array $onlyKeys = []): void {
                // Init cache key
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-DATABASE-FRONTEND: dataSetInstance=%s,onlyKeys()=%d - CALLED!', $dataSetInstance->__toString(), count($onlyKeys)));
                $cacheKey = NULL;
@@ -203,7 +203,7 @@ abstract class BaseDatabaseFrontend extends BaseFrameworkSystem {
         *
         * @return      $indexKey       Index key
         */
-       public final function getIndexKey () {
+       public final function getIndexKey (): string {
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('BASE-DATABASE-FRONTEND: CALLED!');
                return FrameworkBootstrap::getDatabaseInstance()->getIndexKey();
        }
@@ -211,9 +211,9 @@ abstract class BaseDatabaseFrontend extends BaseFrameworkSystem {
        /**
         * Getter for last exception
         *
-        * @return      $lastException  Last exception or NULL if none occured
+        * @return      $lastException  Last exception
         */
-       public final function getLastException () {
+       public final function getLastException (): FrameworkException {
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('BASE-DATABASE-FRONTEND: CALLED!');
                return FrameworkBootstrap::getDatabaseInstance()->getLastException();
        }
@@ -224,9 +224,9 @@ abstract class BaseDatabaseFrontend extends BaseFrameworkSystem {
         *
         * @param       $criteriaInstance       An instance of a Criteria class
         * @param       $onlyKeys                       Only use these keys for a cache key
-        * @return      $resultInstance         An instance of a database result class
+        * @return      $resultInstance         An instance of a SearchableResult class
         */
-       public function doSelectByCriteria (Criteria $criteriaInstance, array $onlyKeys = []) {
+       public function doSelectByCriteria (Criteria $criteriaInstance, array $onlyKeys = []): SearchableResult {
                // Default cache key if cache is not enabled
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-DATABASE-FRONTEND: criteriaInstance=%s,onlyKeys()=%d - CALLED!', $criteriaInstance->__toString(), count($onlyKeys)));
                $cacheKey = NULL;
@@ -241,7 +241,7 @@ abstract class BaseDatabaseFrontend extends BaseFrameworkSystem {
 
                // Does this key exists in cache?
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('BASE-DATABASE-FRONTEND: this->databaseCacheEnabled=%d,cacheKey[%s]=%s', intval($this->databaseCacheEnabled), gettype($cacheKey), $cacheKey));
-               if (($this->databaseCacheEnabled === true) && ($this->getCacheInstance()->offsetExists($cacheKey, BaseDatabaseResult::RESULT_NAME_ROWS, 1))) {
+               if (($this->databaseCacheEnabled === true) && ($this->getCacheInstance()->offsetExists($cacheKey, SearchableResult::RESULT_NAME_ROWS, 1))) {
                        // Then use this result
                        //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('BASE-DATABASE-FRONTEND: Cache used for cacheKey=%s', $cacheKey));
                        $result = $this->getCacheInstance()->offsetGet($cacheKey);
@@ -263,16 +263,16 @@ abstract class BaseDatabaseFrontend extends BaseFrameworkSystem {
                        } else {
                                // This invalid result must be wrapped
                                $result = [
-                                       BaseDatabaseResult::RESULT_NAME_STATUS    => 'invalid',
-                                       BaseDatabaseResult::RESULT_NAME_EXCEPTION => FrameworkBootstrap::getDatabaseInstance()->getLastException(),
+                                       SearchableResult::RESULT_NAME_STATUS    => 'invalid',
+                                       SearchableResult::RESULT_NAME_EXCEPTION => FrameworkBootstrap::getDatabaseInstance()->getLastException(),
                                ];
                        }
                }
 
                // Create an instance of a CachedDatabaseResult class with the given result
-               // @TODO Minor: Update above comment to e.g. BaseDatabaseResult
-               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('BASE-DATABASE-FRONTEND: result[%s]=%s,result[%s]?=%d,result[%s]?=%d', BaseDatabaseResult::RESULT_NAME_STATUS, $result[BaseDatabaseResult::RESULT_NAME_STATUS], BaseDatabaseResult::RESULT_NAME_ROWS, isset($result[BaseDatabaseResult::RESULT_NAME_ROWS]), BaseDatabaseResult::RESULT_NAME_EXCEPTION, isset($result[BaseDatabaseResult::RESULT_NAME_EXCEPTION])));
-               $resultInstance = ObjectFactory::createObjectByConfiguredName('database_result_class', array($result));
+               // @TODO Minor: Update above comment to e.g. SearchableResult
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('BASE-DATABASE-FRONTEND: result[%s]=%s,result[%s]?=%d,result[%s]?=%d', SearchableResult::RESULT_NAME_STATUS, $result[SearchableResult::RESULT_NAME_STATUS], SearchableResult::RESULT_NAME_ROWS, isset($result[SearchableResult::RESULT_NAME_ROWS]), SearchableResult::RESULT_NAME_EXCEPTION, isset($result[SearchableResult::RESULT_NAME_EXCEPTION])));
+               $resultInstance = ObjectFactory::createObjectByConfiguredName('database_result_class', [$result]);
 
                // And return the instance
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-DATABASE-FRONTEND: resultInstance=%s - EXIT!', $resultInstance->__toString()));
index e5edead2224d5941203dbca60ad184d367015857..30146a4199cf4296526074dea3b1625e1cd0fc3e 100644 (file)
@@ -37,7 +37,7 @@ class ???FormatVersion01To02Upgrade extends BaseFormatUpgrade implements Upgrade
         *
         * @return      $upgradeInstance        An instance of this UpgradeableDatabaseFormat class
         */
-       public final static function create???FormatVersion1To2Upgrade () {
+       public final static function create???FormatVersion1To2Upgrade (): UpgradeableDatabaseFormat {
                // Get a new instance
                $upgradeInstance = new ???FormatVersion1To2Upgrade();
 
index cbf5b515aa62639ba0e8375c51fd56ca7f790c43..14ddc5ee476c9b04ab5092c595ac8878d2a023c0 100644 (file)
@@ -102,12 +102,12 @@ class CachedDatabaseResult extends BaseDatabaseResult implements SearchableResul
                if (count($resultArray) == 0) {
                        // Cannot be empty
                        throw new InvalidArgumentException('Array "resultArray" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
-               } elseif (!array_key_exists(BaseDatabaseResult::RESULT_NAME_ROWS, $resultArray)) {
+               } elseif (!array_key_exists(SearchableResult::RESULT_NAME_ROWS, $resultArray)) {
                        // Yes, then abort here
-                       throw new InvalidArgumentException(sprintf('resultArray(%d)=%s has no element "%s".', count($resultArray), print_r($resultArray, TRUE), BaseDatabaseResult::RESULT_NAME_ROWS));
-               } elseif (!array_key_exists(BaseDatabaseResult::RESULT_NAME_STATUS, $resultArray)) {
+                       throw new InvalidArgumentException(sprintf('resultArray(%d)=%s has no element "%s".', count($resultArray), print_r($resultArray, TRUE), SearchableResult::RESULT_NAME_ROWS));
+               } elseif (!array_key_exists(SearchableResult::RESULT_NAME_STATUS, $resultArray)) {
                        // Yes, then abort here
-                       throw new InvalidArgumentException(sprintf('resultArray(%d)=%s has no element "%s".', count($resultArray), print_r($resultArray, TRUE), BaseDatabaseResult::RESULT_NAME_STATUS));
+                       throw new InvalidArgumentException(sprintf('resultArray(%d)=%s has no element "%s".', count($resultArray), print_r($resultArray, TRUE), SearchableResult::RESULT_NAME_STATUS));
                }
 
                // Get a new instance
@@ -122,7 +122,7 @@ class CachedDatabaseResult extends BaseDatabaseResult implements SearchableResul
                $resultInstance->resetCurrentPosition();
 
                // Set affected rows
-               $resultInstance->setAffectedRows(count($resultArray[BaseDatabaseResult::RESULT_NAME_ROWS]));
+               $resultInstance->setAffectedRows(count($resultArray[SearchableResult::RESULT_NAME_ROWS]));
 
                // Return the instance
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('CACHED-DATABASE-RESULT: resultInstance=%s - EXIT!', $resultInstance->__toString()));
@@ -154,7 +154,7 @@ class CachedDatabaseResult extends BaseDatabaseResult implements SearchableResul
                foreach ($updateInstance->getUpdateCriteria() as $criteriaKey => $criteriaValue) {
                        // Update data
                        //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('CACHED-DATABASE-RESULT: criteriaKey=%s,criteriaValue[%s]=%s', $criteriaKey, gettype($criteriaValue), $criteriaValue));
-                       $this->resultArray[BaseDatabaseResult::RESULT_NAME_ROWS][$entryKey][$criteriaKey] = $criteriaValue;
+                       $this->resultArray[SearchableResult::RESULT_NAME_ROWS][$entryKey][$criteriaKey] = $criteriaValue;
 
                        // Mark it as out-dated
                        $this->outDated[$criteriaKey] = 1;
@@ -178,7 +178,7 @@ class CachedDatabaseResult extends BaseDatabaseResult implements SearchableResul
                // Is the result valid?
                if ($this->valid()) {
                        // Next entry found, so cache it
-                       $this->currentRow = $this->resultArray[BaseDatabaseResult::RESULT_NAME_ROWS][$this->currentPos];
+                       $this->currentRow = $this->resultArray[SearchableResult::RESULT_NAME_ROWS][$this->currentPos];
                }
 
                // Trace message
@@ -225,9 +225,9 @@ class CachedDatabaseResult extends BaseDatabaseResult implements SearchableResul
                $current = NULL;
 
                // Does the current enty exist?
-               if (isset($this->resultArray[BaseDatabaseResult::RESULT_NAME_ROWS][$this->currentPos])) {
+               if (isset($this->resultArray[SearchableResult::RESULT_NAME_ROWS][$this->currentPos])) {
                        // Then get it
-                       $current = $this->resultArray[BaseDatabaseResult::RESULT_NAME_ROWS][$this->currentPos];
+                       $current = $this->resultArray[SearchableResult::RESULT_NAME_ROWS][$this->currentPos];
                }
 
                // Return the result
@@ -243,7 +243,7 @@ class CachedDatabaseResult extends BaseDatabaseResult implements SearchableResul
        public function valid (): bool {
                // Check if all is fine ...
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('CACHED-DATABASE-RESULT: this->currentPos=%d - CALLED!', $this->currentPos));
-               $isValid = ($this->ifStatusIsOkay() && isset($this->resultArray[BaseDatabaseResult::RESULT_NAME_ROWS][$this->currentPos]) && isset($this->resultArray[BaseDatabaseResult::RESULT_NAME_ROWS][0]));
+               $isValid = ($this->ifStatusIsOkay() && isset($this->resultArray[SearchableResult::RESULT_NAME_ROWS][$this->currentPos]) && isset($this->resultArray[SearchableResult::RESULT_NAME_ROWS][0]));
 
                // Return the result
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('CACHED-DATABASE-RESULT: isValid=%d - EXIT!', intval($isValid)));
@@ -258,7 +258,7 @@ class CachedDatabaseResult extends BaseDatabaseResult implements SearchableResul
        public function count (): int {
                // Count rows
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('CACHED-DATABASE-RESULT: CALLED!');
-               $count = count($this->resultArray[BaseDatabaseResult::RESULT_NAME_ROWS]);
+               $count = count($this->resultArray[SearchableResult::RESULT_NAME_ROWS]);
 
                // Return it
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('CACHED-DATABASE-RESULT: count=%d - EXIT!', $count));
@@ -273,7 +273,7 @@ class CachedDatabaseResult extends BaseDatabaseResult implements SearchableResul
        public function ifStatusIsOkay (): bool {
                // Check all conditions
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('CACHED-DATABASE-RESULT: this->currentPos=%d - CALLED!', $this->currentPos));
-               $ifStatusOkay = (isset($this->resultArray[BaseDatabaseResult::RESULT_NAME_STATUS]) && $this->resultArray[BaseDatabaseResult::RESULT_NAME_STATUS] === BaseDatabaseBackend::RESULT_OKAY);
+               $ifStatusOkay = (isset($this->resultArray[SearchableResult::RESULT_NAME_STATUS]) && $this->resultArray[SearchableResult::RESULT_NAME_STATUS] === BaseDatabaseBackend::RESULT_OKAY);
 
                // Return status
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('CACHED-DATABASE-RESULT: ifStatusOkay=%s - EXIT!', intval($ifStatusOkay)));
index 5eaf6dbeb794b6a2ce337d1e374a5072c3e6cc1e..5a86cd0bdf413e56ff2ced8425619c3a1d3da1f8 100644 (file)
@@ -30,6 +30,11 @@ use Org\Mxchange\CoreFramework\Generic\FrameworkInterface;
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 interface SearchableResult extends FrameworkInterface {
+       // Result array names
+       const RESULT_NAME_ROWS      = 'rows';
+       const RESULT_NAME_STATUS    = 'status';
+       const RESULT_NAME_EXCEPTION = 'exception';
+
        /**
         * Searches for an entry in the data result and returns it
         *
index 2b18d36bfe515e2d75a73b5493be95494d334fdb..5b8a6b09ed7371567565f2013484e66311c84044 100644 (file)
@@ -10,7 +10,7 @@ use Org\Mxchange\CoreFramework\Database\Backend\DatabaseBackend;
 use Org\Mxchange\CoreFramework\Generic\FrameworkInterface;
 use Org\Mxchange\CoreFramework\Middleware\BaseMiddleware;
 use Org\Mxchange\CoreFramework\Registry\Registerable;
-use Org\Mxchange\CoreFramework\Result\Database\BaseDatabaseResult;
+use Org\Mxchange\CoreFramework\Result\Search\SearchableResult;
 
 // Import SPL stuff
 use \InvalidArgumentException;
@@ -190,17 +190,17 @@ class DatabaseConnection extends BaseMiddleware implements DatabaseConnector, Re
                $result = $this->backendInstance->querySelect($tableName, $criteriaInstance);
 
                // Is a valid array returned?
-               if (!isset($result[BaseDatabaseResult::RESULT_NAME_STATUS])) {
+               if (!isset($result[SearchableResult::RESULT_NAME_STATUS])) {
                        // Missing element
-                       throw new OutOfBoundsException(sprintf('result()=%d does not have element "%s"', count($result), BaseDatabaseResult::RESULT_NAME_STATUS), FrameworkInterface::EXCEPTION_OUT_OF_BOUNDS);
-               } elseif ($result[BaseDatabaseResult::RESULT_NAME_STATUS] != 'ok') {
+                       throw new OutOfBoundsException(sprintf('result()=%d does not have element "%s"', count($result), SearchableResult::RESULT_NAME_STATUS), FrameworkInterface::EXCEPTION_OUT_OF_BOUNDS);
+               } elseif ($result[SearchableResult::RESULT_NAME_STATUS] != 'ok') {
                        // Is exception given?
-                       if (isset($result[BaseDatabaseResult::RESULT_NAME_EXCEPTION])) {
+                       if (isset($result[SearchableResult::RESULT_NAME_EXCEPTION])) {
                                // Attach it
-                               throw new UnexpectedValueException(sprintf('result[%s]=%s is not "ok" with cause', BaseDatabaseResult::RESULT_NAME_STATUS), FrameworkInterface::EXCEPTION_INVALID_ARGUMENT, BaseDatabaseResult::RESULT_NAME_EXCEPTION);
+                               throw new UnexpectedValueException(sprintf('result[%s]=%s is not "ok" with cause', SearchableResult::RESULT_NAME_STATUS), FrameworkInterface::EXCEPTION_INVALID_ARGUMENT, SearchableResult::RESULT_NAME_EXCEPTION);
                        } else {
                                // No exception attached
-                               throw new UnexpectedValueException(sprintf('result[%s]=%s is not "ok"', BaseDatabaseResult::RESULT_NAME_STATUS, $result[BaseDatabaseResult::RESULT_NAME_STATUS]), FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
+                               throw new UnexpectedValueException(sprintf('result[%s]=%s is not "ok"', SearchableResult::RESULT_NAME_STATUS, $result[SearchableResult::RESULT_NAME_STATUS]), FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
                        }
                }