Continued:
authorRoland Häder <roland@mxchange.org>
Wed, 2 Dec 2020 00:47:27 +0000 (01:47 +0100)
committerRoland Häder <roland@mxchange.org>
Wed, 2 Dec 2020 00:47:27 +0000 (01:47 +0100)
- renamed database's "Wrapper" name part to "Frontend"
- added trait for above instance getter/setter

Signed-off-by: Roland Häder <roland@mxchange.org>
42 files changed:
framework/config-global.php
framework/main/classes/class_BaseFrameworkSystem.php
framework/main/classes/commands/html/class_HtmlConfirmCommand.php
framework/main/classes/commands/html/class_HtmlLoginAreaCommand.php
framework/main/classes/commands/html/class_HtmlResendLinkCommand.php
framework/main/classes/criteria/class_BaseCriteria.php
framework/main/classes/database/backend/class_BaseDatabaseBackend.php [new file with mode: 0644]
framework/main/classes/database/class_BaseDatabaseBackend.php [deleted file]
framework/main/classes/database/class_BaseDatabaseWrapper.php [deleted file]
framework/main/classes/database/frontend/class_BaseDatabaseFrontend.php [new file with mode: 0644]
framework/main/classes/database/frontend/class_NewsDatabaseWrapper.php [deleted file]
framework/main/classes/database/frontend/class_PaymentsDatabaseWrapper.php [deleted file]
framework/main/classes/database/frontend/class_UserDatabaseWrapper.php [deleted file]
framework/main/classes/database/frontend/class_UserPointsDatabaseWrapper.php [deleted file]
framework/main/classes/database/frontend/news/class_NewsDatabaseFrontend.php [new file with mode: 0644]
framework/main/classes/database/frontend/payments/class_PaymentsDatabaseFrontend.php [new file with mode: 0644]
framework/main/classes/database/frontend/user/class_UserDatabaseFrontend.php [new file with mode: 0644]
framework/main/classes/database/frontend/user_points/class_UserPointsDatabaseFrontend.php [new file with mode: 0644]
framework/main/classes/database/result/class_CachedDatabaseResult.php
framework/main/classes/discovery/payment/class_LocalPaymentDiscovery.php
framework/main/classes/factories/database/class_DatabaseFrontendFactory.php [new file with mode: 0644]
framework/main/classes/factories/database/class_DatabaseWrapperFactory.php [deleted file]
framework/main/classes/filter/update/class_UserStatusConfimedUpdateFilter.php
framework/main/classes/filter/verifier/class_ConfirmCodeVerifierFilter.php
framework/main/classes/filter/verifier/class_UserUnconfirmedVerifierFilter.php
framework/main/classes/fuse/class_FrameworkFuseWrapper.php_discontinued
framework/main/classes/helper/html/forms/class_HtmlFormHelper.php
framework/main/classes/points/class_UserPoints.php
framework/main/classes/reader/class_ConsoleNewsReader.php
framework/main/classes/reader/class_DefaultNewsReader.php
framework/main/classes/user/class_BaseUser.php
framework/main/classes/user/member/class_Member.php
framework/main/exceptions/user/class_UserNoGuestException.php
framework/main/interfaces/criteria/class_Criteria.php
framework/main/interfaces/database/class_DatabaseWrapper.php [deleted file]
framework/main/interfaces/database/frontend/account/class_ManageableAccountFrontend.php [new file with mode: 0644]
framework/main/interfaces/database/frontend/class_DatabaseFrontend.php [new file with mode: 0644]
framework/main/interfaces/database/frontend/user_points/class_BookablePointsFrontend.php [new file with mode: 0644]
framework/main/interfaces/database/wrapper/class_BookablePointsWrapper.php [deleted file]
framework/main/interfaces/database/wrapper/class_ManageableAccountWrapper.php [deleted file]
framework/main/interfaces/result/class_SearchableResult.php
framework/main/traits/database/frontend/class_DatabaseFrontendTrait.php [new file with mode: 0644]

index bc964adf0290893fe08e8283058630b26472a493..2476e47e65950fb06fc1331123bb83002356440c 100644 (file)
@@ -233,10 +233,10 @@ $cfg->setConfigEntry('crypto_class', 'Org\Mxchange\CoreFramework\Helper\Crypto\C
 $cfg->setConfigEntry('rng_class', 'Org\Mxchange\CoreFramework\Crypto\RandomNumber\RandomNumberGenerator');
 
 // CFG: USER-DB-WRAPPER-CLASS
-$cfg->setConfigEntry('user_db_wrapper_class', 'Org\Mxchange\CoreFramework\Database\Frontend\User\UserDatabaseWrapper');
+$cfg->setConfigEntry('user_db_frontend_class', 'Org\Mxchange\CoreFramework\Database\Frontend\User\UserDatabaseFrontend');
 
 // CFG: NEWS-DB-WRAPPER-CLASS
-$cfg->setConfigEntry('news_db_wrapper_class', 'Org\Mxchange\CoreFramework\Database\Frontend\News\NewsDatabaseWrapper');
+$cfg->setConfigEntry('news_db_frontend_class', 'Org\Mxchange\CoreFramework\Database\Frontend\News\NewsDatabaseFrontend');
 
 // CFG: HTML-CMD-RESOLVER-CLASS
 $cfg->setConfigEntry('html_cmd_resolver_class', 'Org\Mxchange\CoreFramework\Resolver\Command\HtmlCommandResolver');
index 15a9f5fbead9c47707308ca880164f4045f1b163..e64f1241f9492d4954a7206cab6610d3e37444a1 100644 (file)
@@ -5,9 +5,7 @@ namespace Org\Mxchange\CoreFramework\Object;
 // Import framework stuff
 use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
 use Org\Mxchange\CoreFramework\Criteria\Criteria;
-use Org\Mxchange\CoreFramework\Database\Frontend\DatabaseWrapper;
 use Org\Mxchange\CoreFramework\EntryPoint\ApplicationEntryPoint;
-use Org\Mxchange\CoreFramework\Factory\Database\Wrapper\DatabaseWrapperFactory;
 use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
 use Org\Mxchange\CoreFramework\Filesystem\PathWriteProtectedException;
 use Org\Mxchange\CoreFramework\Generic\FrameworkInterface;
@@ -60,18 +58,13 @@ abstract class BaseFrameworkSystem extends stdClass implements FrameworkInterfac
        /**
         * Self-referencing instance
         */
-       private static $instance = NULL;
+       private static $selfInstance = NULL;
 
        /**
         * The real class name
         */
        private $realClass = __CLASS__;
 
-       /**
-        * An instance of a database wrapper class
-        */
-       private $wrapperInstance = NULL;
-
        /**
         * State instance
         */
@@ -209,13 +202,13 @@ abstract class BaseFrameworkSystem extends stdClass implements FrameworkInterfac
         */
        public final function __call (string $methodName, array $args = NULL) {
                // Set self-instance
-               self::$instance = $this;
+               self::$selfInstance = $this;
 
                // Call static method
                self::__callStatic($methodName, $args);
 
                // Clear self-instance
-               self::$instance = NULL;
+               self::$selfInstance = NULL;
        }
 
        /**
@@ -224,7 +217,7 @@ abstract class BaseFrameworkSystem extends stdClass implements FrameworkInterfac
         * @param       $methodName             Name of the missing method
         * @param       $args                   Arguments passed to the method
         * @return      void
-        * @throws      InvalidArgumentException If self::$instance is not a framework's own object
+        * @throws      InvalidArgumentException If self::$selfInstance is not a framework's own object
         */
        public static final function __callStatic (string $methodName, array $args = NULL) {
                // Init argument string and class name
@@ -233,12 +226,12 @@ abstract class BaseFrameworkSystem extends stdClass implements FrameworkInterfac
                $className = 'unknown';
 
                // Is self-instance set?
-               if (self::$instance instanceof FrameworkInterface) {
+               if (self::$selfInstance instanceof FrameworkInterface) {
                        // Framework's own instance
-                       $className = self::$instance->__toString();
-               } elseif (!is_null(self::$instance)) {
+                       $className = self::$selfInstance->__toString();
+               } elseif (!is_null(self::$selfInstance)) {
                        // Invalid argument!
-                       throw new InvalidArgumentException(sprintf('self::instance[%s] is not expected.', gettype(self::$instance)), self::EXCEPTION_SELF_INSTANCE);
+                       throw new InvalidArgumentException(sprintf('self::instance[%s] is not expected.', gettype(self::$selfInstance)), self::EXCEPTION_SELF_INSTANCE);
                }
 
                // Is it NULL, empty or an array?
@@ -438,25 +431,6 @@ abstract class BaseFrameworkSystem extends stdClass implements FrameworkInterfac
                return $webOutputInstance;
        }
 
-       /**
-        * Setter for DatabaseWrapper instance
-        *
-        * @param       $wrapperInstance        An instance of an DatabaseWrapper
-        * @return      void
-        */
-       public final function setWrapperInstance (DatabaseWrapper $wrapperInstance) {
-               $this->wrapperInstance = $wrapperInstance;
-       }
-
-       /**
-        * Getter for DatabaseWrapper instance
-        *
-        * @return      $wrapperInstance        An instance of an DatabaseWrapper
-        */
-       public final function getWrapperInstance () {
-               return $this->wrapperInstance;
-       }
-
        /**
         * Setter for state instance
         *
index f22cd9cfe38b0f15e542b6310e2c974f5b20a796..e0ee64cf88b45252d0e3035f4ddf60ca908a344a 100644 (file)
@@ -7,7 +7,7 @@ use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
 use Org\Mxchange\CoreFramework\Command\BaseCommand;
 use Org\Mxchange\CoreFramework\Command\Commandable;
 use Org\Mxchange\CoreFramework\Controller\Controller;
-use Org\Mxchange\CoreFramework\Database\Frontend\User\UserDatabaseWrapper;
+use Org\Mxchange\CoreFramework\Database\Frontend\User\UserDatabaseFrontend;
 use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
 use Org\Mxchange\CoreFramework\Generic\NullPointerException;
 use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
@@ -120,7 +120,7 @@ class HtmlConfirmCommand extends BaseCommand implements Commandable {
                }
 
                // Set username
-               $this->getTemplateInstance()->assignVariable('username', $userInstance->getField(UserDatabaseWrapper::DB_COLUMN_USERNAME));
+               $this->getTemplateInstance()->assignVariable('username', $userInstance->getField(UserDatabaseFrontend::DB_COLUMN_USERNAME));
 
                // Construct the menu in every command. We could do this in BaseCommand class. But this means
                // *every* command has a navigation system and that is want we don't want.
index dd1aa58a3c6291554c073099194f038c66c2e8e2..be32e26a69bda21af457272715a88a434bb7951f 100644 (file)
@@ -174,9 +174,6 @@ class HtmlLoginAreaCommand extends BaseCommand implements Commandable {
         * @return      void
         */
        public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) {
-               // Default is no action
-               $actionInstance = NULL;
-
                // Get registry
                $registryInstance = GenericRegistry::getRegistry();
 
index 72e24a68bd0d518c29f233b0e37697ecdd1cfcbe..7ddcc8b4fd65757cf2ca4b6d2cc323bd8a13fa56 100644 (file)
@@ -7,7 +7,7 @@ use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
 use Org\Mxchange\CoreFramework\Command\BaseCommand;
 use Org\Mxchange\CoreFramework\Command\Commandable;
 use Org\Mxchange\CoreFramework\Controller\Controller;
-use Org\Mxchange\CoreFramework\Database\Frontend\User\UserDatabaseWrapper;
+use Org\Mxchange\CoreFramework\Database\Frontend\User\UserDatabaseFrontend;
 use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
 use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
 use Org\Mxchange\CoreFramework\Request\Requestable;
@@ -91,7 +91,7 @@ class HtmlResendLinkCommand extends BaseCommand implements Commandable {
                $hashedString = $cryptoInstance->hashString($cryptoInstance->encryptString($randomString));
 
                // Update the user class
-               $userInstance->updateDatabaseField(UserDatabaseWrapper::DB_COLUMN_CONFIRM_HASH, $hashedString);
+               $userInstance->updateDatabaseField(UserDatabaseFrontend::DB_COLUMN_CONFIRM_HASH, $hashedString);
 
                // Re-set config entry to mailer engine
                FrameworkBootstrap::getConfigurationInstance()->setConfigEntry('html_template_class', FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('mail_template_class'));
index c7aff1ed2ee04488262bae124816c5023ef9a00e..e38926cf2e928fd3486b2518ca9930c664e30c08 100644 (file)
@@ -32,9 +32,9 @@ use Org\Mxchange\CoreFramework\Utils\String\StringUtils;
  */
 abstract class BaseCriteria extends BaseFrameworkSystem implements Criteria {
        /**
-        * Wrapper class name stored in config entry
+        * Frontend class name stored in config entry
         */
-       private $wrapperConfigEntry = '';
+       private $frontendConfigEntry = '';
 
        /**
         * Protected constructor
@@ -106,22 +106,22 @@ abstract class BaseCriteria extends BaseFrameworkSystem implements Criteria {
        }
 
        /**
-        * Setter for wrapper class name
+        * Setter for frontend class name
         *
-        * @param       $wrapperConfigEntry             Configuration entry which hold the wrapper class' name
+        * @param       $frontendConfigEntry            Configuration entry which hold the frontend class' name
         * @return      void
         */
-       public final function setWrapperConfigEntry (string $wrapperConfigEntry) {
-               $this->wrapperConfigEntry = $wrapperConfigEntry;
+       public final function setFrontendConfigEntry (string $frontendConfigEntry) {
+               $this->frontendConfigEntry = $frontendConfigEntry;
        }
 
        /**
-        * Getter for wrapper class name
+        * Getter for frontend class name
         *
-        * @return      $wrapperConfigEntry             Configuration entry which hold the wrapper class' name
+        * @return      $frontendConfigEntry            Configuration entry which hold the frontend class' name
         */
-       public final function getWrapperConfigEntry () {
-               return $this->wrapperConfigEntry;
+       public final function getFrontendConfigEntry () {
+               return $this->frontendConfigEntry;
        }
 
        /**
diff --git a/framework/main/classes/database/backend/class_BaseDatabaseBackend.php b/framework/main/classes/database/backend/class_BaseDatabaseBackend.php
new file mode 100644 (file)
index 0000000..a930596
--- /dev/null
@@ -0,0 +1,103 @@
+<?php
+// Own namespace
+namespace Org\Mxchange\CoreFramework\Database\Backend;
+
+// Import framework stuff
+use Org\Mxchange\CoreFramework\Database\Backend\DatabaseBackend;
+use Org\Mxchange\CoreFramework\Generic\FrameworkException;
+use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem;
+
+/**
+ * An abstract database access class for handling database I/O requests
+ *
+ * @see                        DatabaseBackend - An interface for database backends
+ * @author             Roland Haeder <webmaster@shipsimu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2020 Core Developer Team
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.shipsimu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+abstract class BaseDatabaseBackend extends BaseFrameworkSystem implements DatabaseBackend {
+       // Constants for exceptions
+       const EXCEPTION_SQL_QUERY = 0x140;
+
+       // Result array indexes
+       const RESULT_INDEX_ROWS      = 'rows';
+       const RESULT_INDEX_STATUS    = 'status';
+       const RESULT_INDEX_EXCEPTION = 'exception';
+
+       // Constants for MySQL backward-compatiblity (PLEASE FIX THEM!)
+       const DB_CODE_TABLE_MISSING     = 0x100;
+       const DB_CODE_TABLE_UNWRITEABLE = 0x101;
+       const DB_CODE_DATA_FILE_CORRUPT = 0x102;
+
+       // Status results
+       const RESULT_OKAY = 'ok';
+
+       /**
+        * Last thrown exception or NULL if all is fine
+        */
+       private $lastException = NULL;
+
+       /**
+        * Protected constructor
+        *
+        * @param       $className      Name of the class
+        * @return      void
+        */
+       protected function __construct (string $className) {
+               // 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;
+       }
+
+       /**
+        * Removes non-public data from given array.
+        *
+        * @param       $data   An array with possible non-public data that needs to be removed.
+        * @return      $data   A cleaned up array with only public data.
+        */
+       public abstract function removeNonPublicDataFromArray (array $data);
+
+}
diff --git a/framework/main/classes/database/class_BaseDatabaseBackend.php b/framework/main/classes/database/class_BaseDatabaseBackend.php
deleted file mode 100644 (file)
index a930596..0000000
+++ /dev/null
@@ -1,103 +0,0 @@
-<?php
-// Own namespace
-namespace Org\Mxchange\CoreFramework\Database\Backend;
-
-// Import framework stuff
-use Org\Mxchange\CoreFramework\Database\Backend\DatabaseBackend;
-use Org\Mxchange\CoreFramework\Generic\FrameworkException;
-use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem;
-
-/**
- * An abstract database access class for handling database I/O requests
- *
- * @see                        DatabaseBackend - An interface for database backends
- * @author             Roland Haeder <webmaster@shipsimu.org>
- * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2020 Core Developer Team
- * @license            GNU GPL 3.0 or any newer version
- * @link               http://www.shipsimu.org
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-abstract class BaseDatabaseBackend extends BaseFrameworkSystem implements DatabaseBackend {
-       // Constants for exceptions
-       const EXCEPTION_SQL_QUERY = 0x140;
-
-       // Result array indexes
-       const RESULT_INDEX_ROWS      = 'rows';
-       const RESULT_INDEX_STATUS    = 'status';
-       const RESULT_INDEX_EXCEPTION = 'exception';
-
-       // Constants for MySQL backward-compatiblity (PLEASE FIX THEM!)
-       const DB_CODE_TABLE_MISSING     = 0x100;
-       const DB_CODE_TABLE_UNWRITEABLE = 0x101;
-       const DB_CODE_DATA_FILE_CORRUPT = 0x102;
-
-       // Status results
-       const RESULT_OKAY = 'ok';
-
-       /**
-        * Last thrown exception or NULL if all is fine
-        */
-       private $lastException = NULL;
-
-       /**
-        * Protected constructor
-        *
-        * @param       $className      Name of the class
-        * @return      void
-        */
-       protected function __construct (string $className) {
-               // 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;
-       }
-
-       /**
-        * Removes non-public data from given array.
-        *
-        * @param       $data   An array with possible non-public data that needs to be removed.
-        * @return      $data   A cleaned up array with only public data.
-        */
-       public abstract function removeNonPublicDataFromArray (array $data);
-
-}
diff --git a/framework/main/classes/database/class_BaseDatabaseWrapper.php b/framework/main/classes/database/class_BaseDatabaseWrapper.php
deleted file mode 100644 (file)
index 13bf4e2..0000000
+++ /dev/null
@@ -1,297 +0,0 @@
-<?php
-// Own namespace
-namespace Org\Mxchange\CoreFramework\Database\Frontend;
-
-// Import framework stuff
-use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
-use Org\Mxchange\CoreFramework\Criteria\Criteria;
-use Org\Mxchange\CoreFramework\Criteria\Storing\StoreableCriteria;
-use Org\Mxchange\CoreFramework\Database\Backend\BaseDatabaseBackend;
-use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
-use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem;
-
-/**
- * A generic database wrapper
- *
- * @author             Roland Haeder <webmaster@shipsimu.org>
- * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2020 Core Developer Team
- * @license            GNU GPL 3.0 or any newer version
- * @link               http://www.shipsimu.org
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-abstract class BaseDatabaseWrapper extends BaseFrameworkSystem {
-       /**
-        * Cache instance
-        */
-       private $cacheInstance = NULL;
-
-       /**
-        * Current table name to use
-        */
-       private $tableName = 'unknown';
-
-       /**
-        * Protected constructor
-        *
-        * @return      void
-        */
-       protected function __construct ($class) {
-               // Call parent constructor
-               parent::__construct($class);
-
-               // Initialize the cache instance
-               $this->initCacheInstance();
-       }
-
-       /**
-        * Initializes the cache instance with a new object
-        *
-        * @return      void
-        */
-       private final function initCacheInstance () {
-               // Is the cache enabled?
-               if (FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('database_cache_enabled') === true) {
-                       // Set the new instance
-                       $this->cacheInstance = CacheFactory::getFactory()->createConfiguredCache();
-               } // END - if
-       }
-
-       /**
-        * Setter for table name
-        *
-        * @param       $tableName      Name of table name to set
-        * @return      void
-        */
-       protected final function setTableName ($tableName) {
-               $this->tableName = (string) $tableName;
-       }
-
-       /**
-        * Getter for table name
-        *
-        * @return      $tableName      Name of table name to set
-        */
-       protected final function getTableName () {
-               return $this->tableName;
-       }
-
-       /**
-        * 'Inserts' a data set instance into a local file database folder
-        *
-        * @param       $dataSetInstance        A storeable data set
-        * @param       $onlyKeys                       Only use these keys for a cache key
-        * @return      void
-        */
-       protected function queryInsertDataSet (StoreableCriteria $dataSetInstance, array $onlyKeys = []) {
-               // Default cache key is NULL
-               //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-WRAPPER: dataSetInstance=%s,onlyKeys()=%d - CALLED!', $dataSetInstance->__toString(), count($onlyKeys)));
-               $cacheKey = NULL;
-
-               // Is cache enabled?
-               if (FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('database_cache_enabled') === true) {
-                       // First get a key suitable for our cache and extend it with this class name
-                       $cacheKey = $this->getCacheKeyByCriteria($dataSetInstance, $onlyKeys);
-                       //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-WRAPPER: Using cache key ' . $cacheKey . ' for purging ...');
-               } // END - if
-
-               // Does this key exists in cache?
-               //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-WRAPPER: cacheKey[%s]=%s', gettype($cacheKey), $cacheKey));
-               if ((FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('database_cache_enabled') === true) && ($this->cacheInstance->offsetExists($cacheKey))) {
-                       // Purge the cache
-                       //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-WRAPPER: Calling this->cacheInstance->purgeOffset(%s) ...', $cacheKey));
-                       $this->cacheInstance->purgeOffset($cacheKey);
-               } // END - if
-
-               // Handle it over to the middleware
-               FrameworkBootstrap::getDatabaseInstance()->queryInsertDataSet($dataSetInstance);
-
-               // Trace message
-               //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-WRAPPER: EXIT!');
-       }
-
-       /**
-        * 'Updates' a data set instance with a database layer
-        *
-        * @param       $dataSetInstance        A storeable data set
-        * @param       $onlyKeys                       Only use these keys for a cache key
-        * @return      void
-        */
-       protected function queryUpdateDataSet (StoreableCriteria $dataSetInstance, array $onlyKeys = []) {
-               // Init cache key
-               $cacheKey = NULL;
-
-               // Is cache enabled?
-               if (FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('database_cache_enabled') === true) {
-                       // First get a key suitable for our cache and extend it with this class name
-                       $cacheKey = $this->getCacheKeyByCriteria($dataSetInstance, $onlyKeys);
-                       //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-WRAPPER: Using cache key ' . $cacheKey . ' for purging ...');
-               } // END - if
-
-               // Does this key exists in cache?
-               if ((FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('database_cache_enabled') === true) && ($this->cacheInstance->offsetExists($cacheKey))) {
-                       // Purge the cache
-                       $this->cacheInstance->purgeOffset($cacheKey);
-               } // END - if
-
-               // Handle it over to the middleware
-               FrameworkBootstrap::getDatabaseInstance()->queryUpdateDataSet($dataSetInstance);
-       }
-
-       /**
-        * Getter for index key
-        *
-        * @return      $indexKey       Index key
-        */
-       public final function getIndexKey () {
-               return FrameworkBootstrap::getDatabaseInstance()->getIndexKey();
-       }
-
-       /**
-        * Getter for last exception
-        *
-        * @return      $lastException  Last exception or NULL if none occured
-        */
-       public final function getLastException () {
-               return FrameworkBootstrap::getDatabaseInstance()->getLastException();
-       }
-
-       /**
-        * Do a "select" query on the current table with the given search criteria and
-        * store it in cache for later usage
-        *
-        * @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
-        */
-       public function doSelectByCriteria (Criteria $criteriaInstance, array $onlyKeys = []) {
-               // Default cache key if cache is not enabled
-               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-WRAPPER: criteriaInstance=%s,onlyKeys()=%d - CALLED!', $criteriaInstance->__toString(), count($onlyKeys)));
-               $cacheKey = NULL;
-               $result = [];
-
-               // Is the cache enabled?
-               if (FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('database_cache_enabled') === true) {
-                       // First get a key suitable for our cache and extend it with this class name
-                       $cacheKey = $this->getCacheKeyByCriteria($criteriaInstance, $onlyKeys);
-               } // END - if
-
-               // Does this key exists in cache?
-               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-WRAPPER: cacheKey[%s]=%s', gettype($cacheKey), $cacheKey));
-               if ((FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('database_cache_enabled') === true) && ($this->cacheInstance->offsetExists($cacheKey, BaseDatabaseBackend::RESULT_INDEX_ROWS, 1))) {
-                       // Then use this result
-                       //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-WRAPPER: Cache used for cacheKey=%s', $cacheKey));
-                       $result = $this->cacheInstance->offsetGet($cacheKey);
-               } else {
-                       // Now it's time to ask the database layer for this select statement
-                       //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-WRAPPER: Quering database, cacheKey=%s ...', $cacheKey));
-                       $result = FrameworkBootstrap::getDatabaseInstance()->doSelectByTableCriteria($this->getTableName(), $criteriaInstance);
-
-                       // Cache the result if not null
-                       //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-WRAPPER: result[]=%s', gettype($result)));
-                       if (!is_null($result)) {
-                               // Is cache enabled?
-                               if (FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('database_cache_enabled') === true) {
-                                       // A valid result has returned from the database layer
-                                       //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-WRAPPER: Setting cacheKey=%s with result()=%d entries', $cacheKey, count($result)));
-                                       $this->cacheInstance->offsetSet($cacheKey, $result);
-                               } // END - if
-                       } else {
-                               // This invalid result must be wrapped
-                               $result = array(
-                                       BaseDatabaseBackend::RESULT_INDEX_STATUS    => 'invalid',
-                                       BaseDatabaseBackend::RESULT_INDEX_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__)->debugOutput(sprintf('BASE-WRAPPER: result[%s]=%s,result[%s]?=%d,result[%s]?=%d', BaseDatabaseBackend::RESULT_INDEX_STATUS, $result[BaseDatabaseBackend::RESULT_INDEX_STATUS], BaseDatabaseBackend::RESULT_INDEX_ROWS, isset($result[BaseDatabaseBackend::RESULT_INDEX_ROWS]), BaseDatabaseBackend::RESULT_INDEX_EXCEPTION, isset($result[BaseDatabaseBackend::RESULT_INDEX_EXCEPTION])));
-               $resultInstance = ObjectFactory::createObjectByConfiguredName('database_result_class', array($result));
-
-               // And return the instance
-               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-WRAPPER: resultInstance=%s - EXIT!', $resultInstance->__toString()));
-               return $resultInstance;
-       }
-
-       /**
-        * Count the numbers of rows we shall receive
-        *
-        * @param       $criteriaInstance       An instance of a Criteria class
-        * @param       $onlyKeys                       Only use these keys for a cache key
-        * @return      $numRows                        Numbers of rows of database entries
-        */
-       public function doSelectCountByCriteria (Criteria $criteriaInstance, array $onlyKeys = []) {
-               // Total numbers is -1 so we can distinglish between failed and valid queries
-               $numRows = 0;
-
-               // Get the result from above method
-               $resultInstance = $this->doSelectByCriteria($criteriaInstance, $onlyKeys);
-
-               // Was that query fine?
-               if ($resultInstance->ifStatusIsOkay()) {
-                       // Then get the number of rows
-                       $numRows = $resultInstance->getAffectedRows();
-
-                       // Debug message
-                       //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-WRAPPER: numRows=' . $numRows);
-               } // END - if
-
-               // Return the result
-               return $numRows;
-       }
-
-       /**
-        * Getter for primary key used in wrapped table
-        *
-        * @return      $primaryKey             Primary key used in wrapped table
-        */
-       public final function getPrimaryKeyValue () {
-               // Get the table name and a database instance and ask for it
-               $primaryKey = FrameworkBootstrap::getDatabaseInstance()->getPrimaryKeyOfTable($this->getTableName());
-
-               // Return value
-               return $primaryKey;
-       }
-
-       /**
-        * Count rows of this table
-        *
-        * @return      $count  Count of total rows in this table
-        */
-       public final function countTotalRows () {
-               // Get the table name and a database instance and ask for it
-               $count = FrameworkBootstrap::getDatabaseInstance()->countTotalRows($this->getTableName());
-
-               // Return value
-               return $count;
-       }
-
-       /**
-        * Removes non-public data from given array.
-        *
-        * @param       $data   An array with possible non-public data that needs to be removed.
-        * @return      $data   A cleaned up array with only public data.
-        */
-       public function removeNonPublicDataFromArray (array $data) {
-               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('WRAPPER[' . $this->__toString() . ']: Calling FrameworkBootstrap::getDatabaseInstance()->removeNonPublicDataFromArray(data) ...');
-               $data = FrameworkBootstrap::getDatabaseInstance()->removeNonPublicDataFromArray($data);
-
-               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('WRAPPER[' . $this->__toString() . ']: data[]=' . gettype($data));
-               return $data;
-       }
-
-}
diff --git a/framework/main/classes/database/frontend/class_BaseDatabaseFrontend.php b/framework/main/classes/database/frontend/class_BaseDatabaseFrontend.php
new file mode 100644 (file)
index 0000000..0a5aba8
--- /dev/null
@@ -0,0 +1,297 @@
+<?php
+// Own namespace
+namespace Org\Mxchange\CoreFramework\Database\Frontend;
+
+// Import framework stuff
+use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
+use Org\Mxchange\CoreFramework\Criteria\Criteria;
+use Org\Mxchange\CoreFramework\Criteria\Storing\StoreableCriteria;
+use Org\Mxchange\CoreFramework\Database\Backend\BaseDatabaseBackend;
+use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
+use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem;
+
+/**
+ * A generic database frontend
+ *
+ * @author             Roland Haeder <webmaster@shipsimu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2020 Core Developer Team
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.shipsimu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+abstract class BaseDatabaseFrontend extends BaseFrameworkSystem {
+       /**
+        * Cache instance
+        */
+       private $cacheInstance = NULL;
+
+       /**
+        * Current table name to use
+        */
+       private $tableName = 'unknown';
+
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct ($class) {
+               // Call parent constructor
+               parent::__construct($class);
+
+               // Initialize the cache instance
+               $this->initCacheInstance();
+       }
+
+       /**
+        * Initializes the cache instance with a new object
+        *
+        * @return      void
+        */
+       private final function initCacheInstance () {
+               // Is the cache enabled?
+               if (FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('database_cache_enabled') === true) {
+                       // Set the new instance
+                       $this->cacheInstance = CacheFactory::getFactory()->createConfiguredCache();
+               } // END - if
+       }
+
+       /**
+        * Setter for table name
+        *
+        * @param       $tableName      Name of table name to set
+        * @return      void
+        */
+       protected final function setTableName ($tableName) {
+               $this->tableName = (string) $tableName;
+       }
+
+       /**
+        * Getter for table name
+        *
+        * @return      $tableName      Name of table name to set
+        */
+       protected final function getTableName () {
+               return $this->tableName;
+       }
+
+       /**
+        * 'Inserts' a data set instance into a local file database folder
+        *
+        * @param       $dataSetInstance        A storeable data set
+        * @param       $onlyKeys                       Only use these keys for a cache key
+        * @return      void
+        */
+       protected function queryInsertDataSet (StoreableCriteria $dataSetInstance, array $onlyKeys = []) {
+               // Default cache key is NULL
+               //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-WRAPPER: dataSetInstance=%s,onlyKeys()=%d - CALLED!', $dataSetInstance->__toString(), count($onlyKeys)));
+               $cacheKey = NULL;
+
+               // Is cache enabled?
+               if (FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('database_cache_enabled') === true) {
+                       // First get a key suitable for our cache and extend it with this class name
+                       $cacheKey = $this->getCacheKeyByCriteria($dataSetInstance, $onlyKeys);
+                       //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-WRAPPER: Using cache key ' . $cacheKey . ' for purging ...');
+               } // END - if
+
+               // Does this key exists in cache?
+               //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-WRAPPER: cacheKey[%s]=%s', gettype($cacheKey), $cacheKey));
+               if ((FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('database_cache_enabled') === true) && ($this->cacheInstance->offsetExists($cacheKey))) {
+                       // Purge the cache
+                       //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-WRAPPER: Calling this->cacheInstance->purgeOffset(%s) ...', $cacheKey));
+                       $this->cacheInstance->purgeOffset($cacheKey);
+               } // END - if
+
+               // Handle it over to the middleware
+               FrameworkBootstrap::getDatabaseInstance()->queryInsertDataSet($dataSetInstance);
+
+               // Trace message
+               //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-WRAPPER: EXIT!');
+       }
+
+       /**
+        * 'Updates' a data set instance with a database layer
+        *
+        * @param       $dataSetInstance        A storeable data set
+        * @param       $onlyKeys                       Only use these keys for a cache key
+        * @return      void
+        */
+       protected function queryUpdateDataSet (StoreableCriteria $dataSetInstance, array $onlyKeys = []) {
+               // Init cache key
+               $cacheKey = NULL;
+
+               // Is cache enabled?
+               if (FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('database_cache_enabled') === true) {
+                       // First get a key suitable for our cache and extend it with this class name
+                       $cacheKey = $this->getCacheKeyByCriteria($dataSetInstance, $onlyKeys);
+                       //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-WRAPPER: Using cache key ' . $cacheKey . ' for purging ...');
+               } // END - if
+
+               // Does this key exists in cache?
+               if ((FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('database_cache_enabled') === true) && ($this->cacheInstance->offsetExists($cacheKey))) {
+                       // Purge the cache
+                       $this->cacheInstance->purgeOffset($cacheKey);
+               } // END - if
+
+               // Handle it over to the middleware
+               FrameworkBootstrap::getDatabaseInstance()->queryUpdateDataSet($dataSetInstance);
+       }
+
+       /**
+        * Getter for index key
+        *
+        * @return      $indexKey       Index key
+        */
+       public final function getIndexKey () {
+               return FrameworkBootstrap::getDatabaseInstance()->getIndexKey();
+       }
+
+       /**
+        * Getter for last exception
+        *
+        * @return      $lastException  Last exception or NULL if none occured
+        */
+       public final function getLastException () {
+               return FrameworkBootstrap::getDatabaseInstance()->getLastException();
+       }
+
+       /**
+        * Do a "select" query on the current table with the given search criteria and
+        * store it in cache for later usage
+        *
+        * @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
+        */
+       public function doSelectByCriteria (Criteria $criteriaInstance, array $onlyKeys = []) {
+               // Default cache key if cache is not enabled
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-WRAPPER: criteriaInstance=%s,onlyKeys()=%d - CALLED!', $criteriaInstance->__toString(), count($onlyKeys)));
+               $cacheKey = NULL;
+               $result = [];
+
+               // Is the cache enabled?
+               if (FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('database_cache_enabled') === true) {
+                       // First get a key suitable for our cache and extend it with this class name
+                       $cacheKey = $this->getCacheKeyByCriteria($criteriaInstance, $onlyKeys);
+               } // END - if
+
+               // Does this key exists in cache?
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-WRAPPER: cacheKey[%s]=%s', gettype($cacheKey), $cacheKey));
+               if ((FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('database_cache_enabled') === true) && ($this->cacheInstance->offsetExists($cacheKey, BaseDatabaseBackend::RESULT_INDEX_ROWS, 1))) {
+                       // Then use this result
+                       //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-WRAPPER: Cache used for cacheKey=%s', $cacheKey));
+                       $result = $this->cacheInstance->offsetGet($cacheKey);
+               } else {
+                       // Now it's time to ask the database layer for this select statement
+                       //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-WRAPPER: Quering database, cacheKey=%s ...', $cacheKey));
+                       $result = FrameworkBootstrap::getDatabaseInstance()->doSelectByTableCriteria($this->getTableName(), $criteriaInstance);
+
+                       // Cache the result if not null
+                       //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-WRAPPER: result[]=%s', gettype($result)));
+                       if (!is_null($result)) {
+                               // Is cache enabled?
+                               if (FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('database_cache_enabled') === true) {
+                                       // A valid result has returned from the database layer
+                                       //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-WRAPPER: Setting cacheKey=%s with result()=%d entries', $cacheKey, count($result)));
+                                       $this->cacheInstance->offsetSet($cacheKey, $result);
+                               } // END - if
+                       } else {
+                               // This invalid result must be wrapped
+                               $result = array(
+                                       BaseDatabaseBackend::RESULT_INDEX_STATUS    => 'invalid',
+                                       BaseDatabaseBackend::RESULT_INDEX_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__)->debugOutput(sprintf('BASE-WRAPPER: result[%s]=%s,result[%s]?=%d,result[%s]?=%d', BaseDatabaseBackend::RESULT_INDEX_STATUS, $result[BaseDatabaseBackend::RESULT_INDEX_STATUS], BaseDatabaseBackend::RESULT_INDEX_ROWS, isset($result[BaseDatabaseBackend::RESULT_INDEX_ROWS]), BaseDatabaseBackend::RESULT_INDEX_EXCEPTION, isset($result[BaseDatabaseBackend::RESULT_INDEX_EXCEPTION])));
+               $resultInstance = ObjectFactory::createObjectByConfiguredName('database_result_class', array($result));
+
+               // And return the instance
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-WRAPPER: resultInstance=%s - EXIT!', $resultInstance->__toString()));
+               return $resultInstance;
+       }
+
+       /**
+        * Count the numbers of rows we shall receive
+        *
+        * @param       $criteriaInstance       An instance of a Criteria class
+        * @param       $onlyKeys                       Only use these keys for a cache key
+        * @return      $numRows                        Numbers of rows of database entries
+        */
+       public function doSelectCountByCriteria (Criteria $criteriaInstance, array $onlyKeys = []) {
+               // Total numbers is -1 so we can distinglish between failed and valid queries
+               $numRows = 0;
+
+               // Get the result from above method
+               $resultInstance = $this->doSelectByCriteria($criteriaInstance, $onlyKeys);
+
+               // Was that query fine?
+               if ($resultInstance->ifStatusIsOkay()) {
+                       // Then get the number of rows
+                       $numRows = $resultInstance->getAffectedRows();
+
+                       // Debug message
+                       //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-WRAPPER: numRows=' . $numRows);
+               } // END - if
+
+               // Return the result
+               return $numRows;
+       }
+
+       /**
+        * Getter for primary key used in wrapped table
+        *
+        * @return      $primaryKey             Primary key used in wrapped table
+        */
+       public final function getPrimaryKeyValue () {
+               // Get the table name and a database instance and ask for it
+               $primaryKey = FrameworkBootstrap::getDatabaseInstance()->getPrimaryKeyOfTable($this->getTableName());
+
+               // Return value
+               return $primaryKey;
+       }
+
+       /**
+        * Count rows of this table
+        *
+        * @return      $count  Count of total rows in this table
+        */
+       public final function countTotalRows () {
+               // Get the table name and a database instance and ask for it
+               $count = FrameworkBootstrap::getDatabaseInstance()->countTotalRows($this->getTableName());
+
+               // Return value
+               return $count;
+       }
+
+       /**
+        * Removes non-public data from given array.
+        *
+        * @param       $data   An array with possible non-public data that needs to be removed.
+        * @return      $data   A cleaned up array with only public data.
+        */
+       public function removeNonPublicDataFromArray (array $data) {
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('WRAPPER[' . $this->__toString() . ']: Calling FrameworkBootstrap::getDatabaseInstance()->removeNonPublicDataFromArray(data) ...');
+               $data = FrameworkBootstrap::getDatabaseInstance()->removeNonPublicDataFromArray($data);
+
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('WRAPPER[' . $this->__toString() . ']: data[]=' . gettype($data));
+               return $data;
+       }
+
+}
diff --git a/framework/main/classes/database/frontend/class_NewsDatabaseWrapper.php b/framework/main/classes/database/frontend/class_NewsDatabaseWrapper.php
deleted file mode 100644 (file)
index 8c879de..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-<?php
-// Own namespace
-namespace Org\Mxchange\CoreFramework\Database\Frontend\News;
-
-// Import framework stuff
-use Org\Mxchange\CoreFramework\Database\Frontend\BaseDatabaseWrapper;
-use Org\Mxchange\CoreFramework\Registry\Registerable;
-
-/**
- * A database wrapper for news classes
- *
- * @author             Roland Haeder <webmaster@shipsimu.org>
- * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2020 Core Developer Team
- * @license            GNU GPL 3.0 or any newer version
- * @link               http://www.shipsimu.org
- * @todo               Add missing own interface for public methods
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-class NewsDatabaseWrapper extends BaseDatabaseWrapper implements Registerable {
-       // Constants for database table names
-       const DB_TABLE_NEWS = 'news';
-
-       /**
-        * Protected constructor
-        *
-        * @return      void
-        */
-       protected function __construct () {
-               // Call parent constructor
-               parent::__construct(__CLASS__);
-       }
-
-       /**
-        * Creates an instance of this database wrapper by a provided user class
-        *
-        * @return      $wrapperInstance        An instance of the created wrapper class
-        */
-       public static final function createNewsDatabaseWrapper () {
-               // Get a new instance
-               $wrapperInstance = new NewsDatabaseWrapper();
-
-               // Set (primary!) table name
-               $wrapperInstance->setTableName(self::DB_TABLE_NEWS);
-
-               // Return the instance
-               return $wrapperInstance;
-       }
-
-}
diff --git a/framework/main/classes/database/frontend/class_PaymentsDatabaseWrapper.php b/framework/main/classes/database/frontend/class_PaymentsDatabaseWrapper.php
deleted file mode 100644 (file)
index a1a7af7..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-<?php
-// Own namespace
-namespace Org\Mxchange\CoreFramework\Database\Frontend;
-
-// Import framework stuff
-use Org\Mxchange\CoreFramework\Database\Frontend\BaseDatabaseWrapper;
-use Org\Mxchange\CoreFramework\Registry\Registerable;
-
-/**
- * A database wrapper for payments
- *
- * @author             Roland Haeder <webmaster@shipsimu.org>
- * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2020 Core Developer Team
- * @license            GNU GPL 3.0 or any newer version
- * @link               http://www.shipsimu.org
- * @todo               Add missing own interface for public methods
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-class PaymentsDatabaseWrapper extends BaseDatabaseWrapper implements Registerable {
-       // Constants for exceptions
-       const EXCEPTION_CLIENT_USERNAME_NOT_FOUND = 0x180;
-
-       // Constants for database table names
-       const DB_TABLE_PAYMENTS = 'payments';
-
-       /**
-        * Protected constructor
-        *
-        * @return      void
-        */
-       protected function __construct () {
-               // Call parent constructor
-               parent::__construct(__CLASS__);
-       }
-
-       /**
-        * Creates an instance of this database wrapper by a provided user class
-        *
-        * @return      $wrapperInstance        An instance of the created wrapper class
-        */
-       public static final function createPaymentsDatabaseWrapper () {
-               // Get a new instance
-               $wrapperInstance = new PaymentsDatabaseWrapper();
-
-               // Set (primary!) table name
-               $wrapperInstance->setTableName(self::DB_TABLE_PAYMENTS);
-
-               // Return the instance
-               return $wrapperInstance;
-       }
-
-}
diff --git a/framework/main/classes/database/frontend/class_UserDatabaseWrapper.php b/framework/main/classes/database/frontend/class_UserDatabaseWrapper.php
deleted file mode 100644 (file)
index f729abe..0000000
+++ /dev/null
@@ -1,145 +0,0 @@
-<?php
-// Own namespace
-namespace Org\Mxchange\CoreFramework\Database\Frontend\User;
-
-// Import framework stuff
-use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
-use Org\Mxchange\CoreFramework\Database\Frontend\BaseDatabaseWrapper;
-use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
-use Org\Mxchange\CoreFramework\Generic\NullPointerException;
-use Org\Mxchange\CoreFramework\Registration\User\UserRegister;
-use Org\Mxchange\CoreFramework\Registry\Registerable;
-use Org\Mxchange\CoreFramework\Result\Update\UpdateableResult;
-use Org\Mxchange\CoreFramework\Wrapper\Account\ManageableAccountWrapper;
-
-/**
- * A database wrapper for the User class
- *
- * @author             Roland Haeder <webmaster@shipsimu.org>
- * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2020 Core Developer Team
- * @license            GNU GPL 3.0 or any newer version
- * @link               http://www.shipsimu.org
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-class UserDatabaseWrapper extends BaseDatabaseWrapper implements ManageableAccountWrapper, Registerable {
-       // Constants for exceptions
-       const EXCEPTION_CLIENT_USERNAME_NOT_FOUND = 0x180;
-
-       // Constants for database columns
-       const DB_COLUMN_USERID       = 'userid';
-       const DB_COLUMN_USERNAME     = 'username';
-       const DB_COLUMN_EMAIL        = 'email';
-       const DB_COLUMN_CONFIRM_HASH = 'confirm_hash';
-       const DB_COLUMN_USER_STATUS  = 'user_status';
-
-       // Constants for database table names
-       const DB_TABLE_USER = 'user';
-
-       /**
-        * Protected constructor
-        *
-        * @return      void
-        */
-       protected function __construct () {
-               // Call parent constructor
-               parent::__construct(__CLASS__);
-       }
-
-       /**
-        * Creates an instance of this database wrapper by a provided user class
-        *
-        * @return      $wrapperInstance        An instance of the created wrapper class
-        */
-       public static final function createUserDatabaseWrapper () {
-               // Get a new instance
-               $wrapperInstance = new UserDatabaseWrapper();
-
-               // Set (primary!) table name
-               $wrapperInstance->setTableName(self::DB_TABLE_USER);
-
-               // Return the instance
-               return $wrapperInstance;
-       }
-
-       /**
-        * Handles inserting the registration data from a registration instance into the database
-        *
-        * @param       $registrationInstance   An instance of a registration class
-        * @return      void
-        */
-       public function insertRegistrationObject (UserRegister $registrationInstance) {
-               // Generate a data set for the request
-               $dataSetInstance = ObjectFactory::createObjectByConfiguredName('dataset_criteria_class', array(self::DB_TABLE_USER));
-
-               // Set the primary key
-               $dataSetInstance->setUniqueKey(self::DB_COLUMN_USERNAME);
-
-               // Add registration elements to the dataset
-               $registrationInstance->addElementsToDataSet($dataSetInstance);
-
-               // "Insert" this request instance completely into the database
-               $this->queryInsertDataSet($dataSetInstance);
-       }
-
-       /**
-        * Updates an user database entry with given result
-        *
-        * @param       $resultInstance         An instance of a UpdateableResult class
-        * @return      void
-        * @throws      NullPointerException    If $updateInstance or $searchInstance is null
-        */
-       public function doUpdateByResult (UpdateableResult $resultInstance) {
-               // Get the search instance from result
-               $searchInstance = $resultInstance->getSearchInstance();
-
-               // Is this null?
-               if (is_null($searchInstance)) {
-                       // Get the update instance
-                       $updateInstance = $resultInstance->getUpdateInstance();
-
-                       // Is this null?
-                       if (is_null($updateInstance)) {
-                               // Throw an exception here
-                               throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER);
-                       } // END - if
-
-                       // Get search instance from update instance
-                       $searchInstance = $updateInstance->getSearchInstance();
-
-                       // Is it still null?
-                       if (is_null($searchInstance)) {
-                               // Throw an exception here
-                               throw new NullPointerException($updateInstance, self::EXCEPTION_IS_NULL_POINTER);
-                       } // END - if
-               } // END - if
-
-               // Generate a data set object
-               $dataSetInstance = ObjectFactory::createObjectByConfiguredName('dataset_criteria_class', array(self::DB_TABLE_USER));
-
-               // Add seach criteria
-               $dataSetInstance->setSearchInstance($searchInstance);
-
-               // Set the primary key
-               $dataSetInstance->setUniqueKey(self::DB_COLUMN_USERNAME);
-
-               // Add all update criteria to the database set
-               $resultInstance->addElementsToDataSet($dataSetInstance);
-
-               // "Update" this request with the database
-               FrameworkBootstrap::getDatabaseInstance()->queryUpdateDataSet($dataSetInstance);
-       }
-
-}
diff --git a/framework/main/classes/database/frontend/class_UserPointsDatabaseWrapper.php b/framework/main/classes/database/frontend/class_UserPointsDatabaseWrapper.php
deleted file mode 100644 (file)
index 096cb90..0000000
+++ /dev/null
@@ -1,119 +0,0 @@
-<?php
-// Own namespace
-namespace Org\Mxchange\CoreFramework\Database\Frontend\Points;
-
-// Import framework stuff
-use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
-use Org\Mxchange\CoreFramework\Database\Frontend\BaseDatabaseWrapper;
-use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
-use Org\Mxchange\CoreFramework\Registry\Registerable;
-use Org\Mxchange\CoreFramework\Result\Update\UpdateableResult;
-
-/**
- * A database wrapper for user points classes
- *
- * @author             Roland Haeder <webmaster@shipsimu.org>
- * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2020 Core Developer Team
- * @license            GNU GPL 3.0 or any newer version
- * @link               http://www.shipsimu.org
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-class UserPointsDatabaseWrapper extends BaseDatabaseWrapper implements BookablePointsWrapper, Registerable {
-       /**
-        * Constants for database table names
-        */
-       const DB_TABLE_USER_POINTS = 'user_points';
-
-       /**
-        * Name of the user->points column
-        */
-       const DB_COLUMN_POINTS_UID = 'points_uid';
-
-       /**
-        * Name of the points column
-        */
-       const DB_COLUMN_POINTS = 'points';
-
-       /**
-        * Protected constructor
-        *
-        * @return      void
-        */
-       protected function __construct () {
-               // Call parent constructor
-               parent::__construct(__CLASS__);
-       }
-
-       /**
-        * Creates an instance of this database wrapper by a provided user class
-        *
-        * @return      $wrapperInstance        An instance of the created wrapper class
-        */
-       public static final function createUserPointsDatabaseWrapper () {
-               // Get a new instance
-               $wrapperInstance = new UserPointsDatabaseWrapper();
-
-               // Set (primary!) table name
-               $wrapperInstance->setTableName(self::DB_TABLE_USER_POINTS);
-
-               // Return the instance
-               return $wrapperInstance;
-       }
-
-       /**
-        * Inserts the given points for the given user in the database
-        *
-        * @param       $pointsInstance         An instance of a user class
-        * @return      void
-        */
-       public function insertUserPoints (BookablePoints $pointsInstance) {
-               // Generate a data set for the request
-               $dataSetInstance = ObjectFactory::createObjectByConfiguredName('dataset_criteria_class', array(self::DB_TABLE_USER_POINTS));
-
-               // Set the primary key
-               $dataSetInstance->setUniqueKey(self::DB_COLUMN_POINTS_UID);
-
-               // Add registration elements to the dataset
-               $pointsInstance->addElementsToDataSet($dataSetInstance);
-
-               // "Insert" this request instance completely into the database
-               $this->queryInsertDataSet($dataSetInstance);
-       }
-
-       /**
-        * Updates an user database entry with given result
-        *
-        * @param       $resultInstance         An instance of a UpdateableResult class
-        * @return      void
-        */
-       public function doUpdateByResult (UpdateableResult $resultInstance) {
-               // Generate a data set object
-               $dataSetInstance = ObjectFactory::createObjectByConfiguredName('dataset_criteria_class', array(self::DB_TABLE_USER_POINTS));
-
-               // Add all update criteria to the database set
-               $resultInstance->addElementsToDataSet($dataSetInstance);
-
-               // Add seach criteria
-               $dataSetInstance->setSearchInstance($resultInstance->getUpdateInstance()->getSearchInstance());
-
-               // Set the primary key
-               $dataSetInstance->setUniqueKey(self::DB_COLUMN_POINTS_UID);
-
-               // "Update" this request with the database
-               FrameworkBootstrap::getDatabaseInstance()->queryUpdateDataSet($dataSetInstance);
-       }
-
-}
diff --git a/framework/main/classes/database/frontend/news/class_NewsDatabaseFrontend.php b/framework/main/classes/database/frontend/news/class_NewsDatabaseFrontend.php
new file mode 100644 (file)
index 0000000..f99a512
--- /dev/null
@@ -0,0 +1,62 @@
+<?php
+// Own namespace
+namespace Org\Mxchange\CoreFramework\Database\Frontend\News;
+
+// Import framework stuff
+use Org\Mxchange\CoreFramework\Database\Frontend\BaseDatabaseFrontend;
+use Org\Mxchange\CoreFramework\Registry\Registerable;
+
+/**
+ * A database frontend for news classes
+ *
+ * @author             Roland Haeder <webmaster@shipsimu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2020 Core Developer Team
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.shipsimu.org
+ * @todo               Add missing own interface for public methods
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class NewsDatabaseFrontend extends BaseDatabaseFrontend implements Registerable {
+       // Constants for database table names
+       const DB_TABLE_NEWS = 'news';
+
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+       }
+
+       /**
+        * Creates an instance of this database frontend by a provided user class
+        *
+        * @return      $frontendInstance       An instance of the created frontend class
+        */
+       public static final function createNewsDatabaseFrontend () {
+               // Get a new instance
+               $frontendInstance = new NewsDatabaseFrontend();
+
+               // Set (primary!) table name
+               $frontendInstance->setTableName(self::DB_TABLE_NEWS);
+
+               // Return the instance
+               return $frontendInstance;
+       }
+
+}
diff --git a/framework/main/classes/database/frontend/payments/class_PaymentsDatabaseFrontend.php b/framework/main/classes/database/frontend/payments/class_PaymentsDatabaseFrontend.php
new file mode 100644 (file)
index 0000000..215dbc6
--- /dev/null
@@ -0,0 +1,65 @@
+<?php
+// Own namespace
+namespace Org\Mxchange\CoreFramework\Database\Frontend;
+
+// Import framework stuff
+use Org\Mxchange\CoreFramework\Database\Frontend\BaseDatabaseFrontend;
+use Org\Mxchange\CoreFramework\Registry\Registerable;
+
+/**
+ * A database frontend for payments
+ *
+ * @author             Roland Haeder <webmaster@shipsimu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2020 Core Developer Team
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.shipsimu.org
+ * @todo               Add missing own interface for public methods
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class PaymentsDatabaseFrontend extends BaseDatabaseFrontend implements Registerable {
+       // Constants for exceptions
+       const EXCEPTION_CLIENT_USERNAME_NOT_FOUND = 0x180;
+
+       // Constants for database table names
+       const DB_TABLE_PAYMENTS = 'payments';
+
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+       }
+
+       /**
+        * Creates an instance of this database frontend by a provided user class
+        *
+        * @return      $frontendInstance       An instance of the created frontend class
+        */
+       public static final function createPaymentsDatabaseFrontend () {
+               // Get a new instance
+               $frontendInstance = new PaymentsDatabaseFrontend();
+
+               // Set (primary!) table name
+               $frontendInstance->setTableName(self::DB_TABLE_PAYMENTS);
+
+               // Return the instance
+               return $frontendInstance;
+       }
+
+}
diff --git a/framework/main/classes/database/frontend/user/class_UserDatabaseFrontend.php b/framework/main/classes/database/frontend/user/class_UserDatabaseFrontend.php
new file mode 100644 (file)
index 0000000..99fcaee
--- /dev/null
@@ -0,0 +1,145 @@
+<?php
+// Own namespace
+namespace Org\Mxchange\CoreFramework\Database\Frontend\User;
+
+// Import framework stuff
+use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
+use Org\Mxchange\CoreFramework\Database\Frontend\BaseDatabaseFrontend;
+use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
+use Org\Mxchange\CoreFramework\Frontend\Account\ManageableAccountFrontend;
+use Org\Mxchange\CoreFramework\Generic\NullPointerException;
+use Org\Mxchange\CoreFramework\Registration\User\UserRegister;
+use Org\Mxchange\CoreFramework\Registry\Registerable;
+use Org\Mxchange\CoreFramework\Result\Update\UpdateableResult;
+
+/**
+ * A database frontend for the User class
+ *
+ * @author             Roland Haeder <webmaster@shipsimu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2020 Core Developer Team
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.shipsimu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class UserDatabaseFrontend extends BaseDatabaseFrontend implements ManageableAccountFrontend, Registerable {
+       // Constants for exceptions
+       const EXCEPTION_CLIENT_USERNAME_NOT_FOUND = 0x180;
+
+       // Constants for database columns
+       const DB_COLUMN_USERID       = 'userid';
+       const DB_COLUMN_USERNAME     = 'username';
+       const DB_COLUMN_EMAIL        = 'email';
+       const DB_COLUMN_CONFIRM_HASH = 'confirm_hash';
+       const DB_COLUMN_USER_STATUS  = 'user_status';
+
+       // Constants for database table names
+       const DB_TABLE_USER = 'user';
+
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+       }
+
+       /**
+        * Creates an instance of this database frontend by a provided user class
+        *
+        * @return      $frontendInstance       An instance of the created frontend class
+        */
+       public static final function createUserDatabaseFrontend () {
+               // Get a new instance
+               $frontendInstance = new UserDatabaseFrontend();
+
+               // Set (primary!) table name
+               $frontendInstance->setTableName(self::DB_TABLE_USER);
+
+               // Return the instance
+               return $frontendInstance;
+       }
+
+       /**
+        * Handles inserting the registration data from a registration instance into the database
+        *
+        * @param       $registrationInstance   An instance of a registration class
+        * @return      void
+        */
+       public function insertRegistrationObject (UserRegister $registrationInstance) {
+               // Generate a data set for the request
+               $dataSetInstance = ObjectFactory::createObjectByConfiguredName('dataset_criteria_class', array(self::DB_TABLE_USER));
+
+               // Set the primary key
+               $dataSetInstance->setUniqueKey(self::DB_COLUMN_USERNAME);
+
+               // Add registration elements to the dataset
+               $registrationInstance->addElementsToDataSet($dataSetInstance);
+
+               // "Insert" this request instance completely into the database
+               $this->queryInsertDataSet($dataSetInstance);
+       }
+
+       /**
+        * Updates an user database entry with given result
+        *
+        * @param       $resultInstance         An instance of a UpdateableResult class
+        * @return      void
+        * @throws      NullPointerException    If $updateInstance or $searchInstance is null
+        */
+       public function doUpdateByResult (UpdateableResult $resultInstance) {
+               // Get the search instance from result
+               $searchInstance = $resultInstance->getSearchInstance();
+
+               // Is this null?
+               if (is_null($searchInstance)) {
+                       // Get the update instance
+                       $updateInstance = $resultInstance->getUpdateInstance();
+
+                       // Is this null?
+                       if (is_null($updateInstance)) {
+                               // Throw an exception here
+                               throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER);
+                       } // END - if
+
+                       // Get search instance from update instance
+                       $searchInstance = $updateInstance->getSearchInstance();
+
+                       // Is it still null?
+                       if (is_null($searchInstance)) {
+                               // Throw an exception here
+                               throw new NullPointerException($updateInstance, self::EXCEPTION_IS_NULL_POINTER);
+                       } // END - if
+               } // END - if
+
+               // Generate a data set object
+               $dataSetInstance = ObjectFactory::createObjectByConfiguredName('dataset_criteria_class', array(self::DB_TABLE_USER));
+
+               // Add seach criteria
+               $dataSetInstance->setSearchInstance($searchInstance);
+
+               // Set the primary key
+               $dataSetInstance->setUniqueKey(self::DB_COLUMN_USERNAME);
+
+               // Add all update criteria to the database set
+               $resultInstance->addElementsToDataSet($dataSetInstance);
+
+               // "Update" this request with the database
+               FrameworkBootstrap::getDatabaseInstance()->queryUpdateDataSet($dataSetInstance);
+       }
+
+}
diff --git a/framework/main/classes/database/frontend/user_points/class_UserPointsDatabaseFrontend.php b/framework/main/classes/database/frontend/user_points/class_UserPointsDatabaseFrontend.php
new file mode 100644 (file)
index 0000000..77f318b
--- /dev/null
@@ -0,0 +1,119 @@
+<?php
+// Own namespace
+namespace Org\Mxchange\CoreFramework\Database\Frontend\Points;
+
+// Import framework stuff
+use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
+use Org\Mxchange\CoreFramework\Database\Frontend\BaseDatabaseFrontend;
+use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
+use Org\Mxchange\CoreFramework\Registry\Registerable;
+use Org\Mxchange\CoreFramework\Result\Update\UpdateableResult;
+
+/**
+ * A database frontend for user points classes
+ *
+ * @author             Roland Haeder <webmaster@shipsimu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2020 Core Developer Team
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.shipsimu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class UserPointsDatabaseFrontend extends BaseDatabaseFrontend implements BookablePointsFrontend, Registerable {
+       /**
+        * Constants for database table names
+        */
+       const DB_TABLE_USER_POINTS = 'user_points';
+
+       /**
+        * Name of the user->points column
+        */
+       const DB_COLUMN_POINTS_UID = 'points_uid';
+
+       /**
+        * Name of the points column
+        */
+       const DB_COLUMN_POINTS = 'points';
+
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+       }
+
+       /**
+        * Creates an instance of this database frontend by a provided user class
+        *
+        * @return      $frontendInstance       An instance of the created frontend class
+        */
+       public static final function createUserPointsDatabaseFrontend () {
+               // Get a new instance
+               $frontendInstance = new UserPointsDatabaseFrontend();
+
+               // Set (primary!) table name
+               $frontendInstance->setTableName(self::DB_TABLE_USER_POINTS);
+
+               // Return the instance
+               return $frontendInstance;
+       }
+
+       /**
+        * Inserts the given points for the given user in the database
+        *
+        * @param       $pointsInstance         An instance of a user class
+        * @return      void
+        */
+       public function insertUserPoints (BookablePoints $pointsInstance) {
+               // Generate a data set for the request
+               $dataSetInstance = ObjectFactory::createObjectByConfiguredName('dataset_criteria_class', array(self::DB_TABLE_USER_POINTS));
+
+               // Set the primary key
+               $dataSetInstance->setUniqueKey(self::DB_COLUMN_POINTS_UID);
+
+               // Add registration elements to the dataset
+               $pointsInstance->addElementsToDataSet($dataSetInstance);
+
+               // "Insert" this request instance completely into the database
+               $this->queryInsertDataSet($dataSetInstance);
+       }
+
+       /**
+        * Updates an user database entry with given result
+        *
+        * @param       $resultInstance         An instance of a UpdateableResult class
+        * @return      void
+        */
+       public function doUpdateByResult (UpdateableResult $resultInstance) {
+               // Generate a data set object
+               $dataSetInstance = ObjectFactory::createObjectByConfiguredName('dataset_criteria_class', array(self::DB_TABLE_USER_POINTS));
+
+               // Add all update criteria to the database set
+               $resultInstance->addElementsToDataSet($dataSetInstance);
+
+               // Add seach criteria
+               $dataSetInstance->setSearchInstance($resultInstance->getUpdateInstance()->getSearchInstance());
+
+               // Set the primary key
+               $dataSetInstance->setUniqueKey(self::DB_COLUMN_POINTS_UID);
+
+               // "Update" this request with the database
+               FrameworkBootstrap::getDatabaseInstance()->queryUpdateDataSet($dataSetInstance);
+       }
+
+}
index 9aca86df5613256623880e0919c3c8346c653246..56a6afcc562245dbca077697c96e6070521693b2 100644 (file)
@@ -6,7 +6,7 @@ namespace Org\Mxchange\CoreFramework\Result\Database;
 use Org\Mxchange\CoreFramework\Criteria\Local\LocalSearchCriteria;
 use Org\Mxchange\CoreFramework\Criteria\Local\LocalUpdateCriteria;
 use Org\Mxchange\CoreFramework\Criteria\Storing\StoreableCriteria;
-use Org\Mxchange\CoreFramework\Database\Frontend\DatabaseWrapper;
+use Org\Mxchange\CoreFramework\Database\Frontend\DatabaseFrontend;
 use Org\Mxchange\CoreFramework\Database\Backend\BaseDatabaseBackend;
 use Org\Mxchange\CoreFramework\Result\Search\SearchableResult;
 use Org\Mxchange\CoreFramework\Result\Update\UpdateableResult;
@@ -416,13 +416,13 @@ class CachedDatabaseResult extends BaseDatabaseResult implements SearchableResul
         * Solver for result index value with call-back method
         *
         * @param       $databaseColumn         Database column where the index might be found
-        * @param       $wrapperInstance        The wrapper instance to ask for array element
+        * @param       $frontendInstance       The frontend instance to ask for array element
         * @para        $callBack                       Call-back object for setting the index;
         *                                                              0=object instance,1=method name
         * @return      void
         * @todo        Find a caching way without modifying the result array
         */
-       public function solveResultIndex ($databaseColumn, DatabaseWrapper $wrapperInstance, array $callBack) {
+       public function solveResultIndex ($databaseColumn, DatabaseFrontend $frontendInstance, array $callBack) {
                // By default nothing is found
                $indexValue = 0;
 
@@ -430,7 +430,7 @@ class CachedDatabaseResult extends BaseDatabaseResult implements SearchableResul
                if ($this->find($databaseColumn)) {
                        // Use this value
                        $indexValue = $this->getFoundValue();
-               } elseif ($this->find($wrapperInstance->getIndexKey())) {
+               } elseif ($this->find($frontendInstance->getIndexKey())) {
                        // Use this value
                        $indexValue = $this->getFoundValue();
                }
index aaab6c2266b930585dff593b5fcb64dd6ba3b9c1..0339a94d46b29a095d3ae5fa800c85b5574dfa17 100644 (file)
@@ -5,7 +5,7 @@ namespace Org\Mxchange\CoreFramework\Discovery\Payment;
 // Import framework stuff
 use Org\Mxchange\CoreFramework\Discovery\BaseDiscovery;
 use Org\Mxchange\CoreFramework\Discovery\Discoverable;
-use Org\Mxchange\CoreFramework\Factory\Database\Wrapper\DatabaseWrapperFactory;
+use Org\Mxchange\CoreFramework\Factory\Database\Frontend\DatabaseFrontendFactory;
 use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
 use Org\Mxchange\CoreFramework\Filter\Filterable;
 use Org\Mxchange\CoreFramework\Helper\Template\HelpableTemplate;
@@ -81,11 +81,11 @@ class LocalPaymentDiscovery extends BaseDiscovery implements Discoverable, Regis
                $criteriaInstance->addCriteria('payment_action', $this->getActionName() . '_action');
                $criteriaInstance->setLimit(1);
 
-               // Get a wrapper instance
-               $wrapperInstance = DatabaseWrapperFactory::createWrapperByConfiguredName('payment_db_wrapper_class');
+               // Get a frontend instance
+               $frontendInstance = DatabaseFrontendFactory::createFrontendByConfiguredName('payment_db_frontend_class');
 
                // Get result back
-               $resultInstance = $wrapperInstance->doSelectByCriteria($criteriaInstance);
+               $resultInstance = $frontendInstance->doSelectByCriteria($criteriaInstance);
 
                // Advanced to next entry and assert on it as it should always be there
                assert($resultInstance->valid());
diff --git a/framework/main/classes/factories/database/class_DatabaseFrontendFactory.php b/framework/main/classes/factories/database/class_DatabaseFrontendFactory.php
new file mode 100644 (file)
index 0000000..8df8c28
--- /dev/null
@@ -0,0 +1,69 @@
+<?php
+// Own namespace
+namespace Org\Mxchange\CoreFramework\Factory\Database\Frontend;
+
+// Import framework stuff
+use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
+use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
+
+/**
+ * A factory class for socket registries
+ *
+ * @author             Roland Haeder <webmaster@shipsimu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2020 Core Developer Team
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.shipsimu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class DatabaseFrontendFactory extends ObjectFactory {
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+       }
+
+       /**
+        * Returns a singleton socket registry instance. If an instance is found in
+        * the registry it will be returned, else a new instance is created and
+        * stored in the same registry entry.
+        *
+        * @return      $frontendInstance       A database frontend instance
+        */
+       public static final function createFrontendByConfiguredName ($frontendName) {
+               // Get registry instance
+               $registryInstance = GenericRegistry::getRegistry();
+
+               // Do we have an instance in the registry?
+               if ($registryInstance->instanceExists($frontendName)) {
+                       // Then use this instance
+                       $frontendInstance = $registryInstance->getInstance($frontendName);
+               } else {
+                       // Get the registry instance
+                       $frontendInstance = self::createObjectByConfiguredName($frontendName);
+
+                       // Set the instance in registry for further use
+                       $registryInstance->addInstance($frontendName, $frontendInstance);
+               }
+
+               // Return the instance
+               return $frontendInstance;
+       }
+
+}
diff --git a/framework/main/classes/factories/database/class_DatabaseWrapperFactory.php b/framework/main/classes/factories/database/class_DatabaseWrapperFactory.php
deleted file mode 100644 (file)
index f64dd74..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-<?php
-// Own namespace
-namespace Org\Mxchange\CoreFramework\Factory\Database\Wrapper;
-
-// Import framework stuff
-use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
-use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
-
-/**
- * A factory class for socket registries
- *
- * @author             Roland Haeder <webmaster@shipsimu.org>
- * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2020 Core Developer Team
- * @license            GNU GPL 3.0 or any newer version
- * @link               http://www.shipsimu.org
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-class DatabaseWrapperFactory extends ObjectFactory {
-       /**
-        * Protected constructor
-        *
-        * @return      void
-        */
-       protected function __construct () {
-               // Call parent constructor
-               parent::__construct(__CLASS__);
-       }
-
-       /**
-        * Returns a singleton socket registry instance. If an instance is found in
-        * the registry it will be returned, else a new instance is created and
-        * stored in the same registry entry.
-        *
-        * @return      $wrapperInstance        A database wrapper instance
-        */
-       public static final function createWrapperByConfiguredName ($wrapperName) {
-               // Get registry instance
-               $registryInstance = GenericRegistry::getRegistry();
-
-               // Do we have an instance in the registry?
-               if ($registryInstance->instanceExists($wrapperName)) {
-                       // Then use this instance
-                       $wrapperInstance = $registryInstance->getInstance($wrapperName);
-               } else {
-                       // Get the registry instance
-                       $wrapperInstance = self::createObjectByConfiguredName($wrapperName);
-
-                       // Set the instance in registry for further use
-                       $registryInstance->addInstance($wrapperName, $wrapperInstance);
-               }
-
-               // Return the instance
-               return $wrapperInstance;
-       }
-
-}
index 1c41d370ee56569fa7ee610e0e448b463051acf2..6c3467506bd9f661791d8d17d41c30952347851e 100644 (file)
@@ -4,7 +4,7 @@ namespace Org\Mxchange\CoreFramework\Filter\User\Status;
 
 // Import framework stuff
 use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
-use Org\Mxchange\CoreFramework\Database\Frontend\User\UserDatabaseWrapper;
+use Org\Mxchange\CoreFramework\Database\Frontend\User\UserDatabaseFrontend;
 use Org\Mxchange\CoreFramework\Filter\BaseFilter;
 use Org\Mxchange\CoreFramework\Filter\Filterable;
 use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
@@ -72,10 +72,10 @@ class UserStatusConfimedUpdateFilter extends BaseFilter implements Filterable {
                $confirmed = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('user_status_confirmed');
 
                // Update the user status to "confirmed" here
-               $userInstance->updateDatabaseField(UserDatabaseWrapper::DB_COLUMN_USER_STATUS, $confirmed);
+               $userInstance->updateDatabaseField(UserDatabaseFrontend::DB_COLUMN_USER_STATUS, $confirmed);
 
                // Wipe out the confirm hash for extra security
-               $userInstance->updateDatabaseField(UserDatabaseWrapper::DB_COLUMN_CONFIRM_HASH, '');
+               $userInstance->updateDatabaseField(UserDatabaseFrontend::DB_COLUMN_CONFIRM_HASH, '');
 
                // Write all updates to the database
                die(__METHOD__ . ': REWRITE!' . PHP_EOL);
index e832eb0ca983cc33e33212f2c38011c5dbd49688..3561927420977cab9fb6188053a5c203ee42da1a 100644 (file)
@@ -3,7 +3,7 @@
 namespace Org\Mxchange\CoreFramework\Filter\Verifier\Confirmation;
 
 // Import framework stuff
-use Org\Mxchange\CoreFramework\Database\Frontend\User\UserDatabaseWrapper;
+use Org\Mxchange\CoreFramework\Database\Frontend\User\UserDatabaseFrontend;
 use Org\Mxchange\CoreFramework\Filter\BaseFilter;
 use Org\Mxchange\CoreFramework\Filter\Chain\FilterChainException;
 use Org\Mxchange\CoreFramework\Filter\Filterable;
@@ -94,7 +94,7 @@ class ConfirmCodeVerifierFilter extends BaseFilter implements Filterable {
                $userInstance = GenericRegistry::getRegistry()->getInstance('user');
 
                // Get the confirm code from user for comparison
-               $userCode = $userInstance->getField(UserDatabaseWrapper::DB_COLUMN_CONFIRM_HASH);
+               $userCode = $userInstance->getField(UserDatabaseFrontend::DB_COLUMN_CONFIRM_HASH);
 
                // Do we have the same code or different?
                if ($userCode != $confirmCode) {
index 94acdfc559c661035dd8386ae7335ca69176cde6..c62a9eff9b4ef7871bec5f7841218e9f3e972316 100644 (file)
@@ -4,7 +4,7 @@ namespace Org\Mxchange\CoreFramework\Filter\Verifier\User;
 
 // Import framework stuff
 use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
-use Org\Mxchange\CoreFramework\Database\Frontend\User\UserDatabaseWrapper;
+use Org\Mxchange\CoreFramework\Database\Frontend\User\UserDatabaseFrontend;
 use Org\Mxchange\CoreFramework\Factory\User\UserFactory;
 use Org\Mxchange\CoreFramework\Filter\BaseFilter;
 use Org\Mxchange\CoreFramework\Filter\Filterable;
@@ -82,7 +82,7 @@ class UserUnconfirmedVerifierFilter extends BaseFilter implements Filterable {
                } // END - if
 
                // Is the user account confirmed?
-               if ($userInstance->getField(UserDatabaseWrapper::DB_COLUMN_USER_STATUS) != FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('user_status_unconfirmed')) {
+               if ($userInstance->getField(UserDatabaseFrontend::DB_COLUMN_USER_STATUS) != FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('user_status_unconfirmed')) {
                        // Request is invalid!
                        $requestInstance->requestIsValid(false);
 
index 1c86c9695288c2267e1d8a5f1570c8c72a20ef86..ff011978c4f734a1ffbdd26729d58f84e8647429 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 // Own namespace
-namespace Org\Mxchange\CoreFramework\Wrapper\Fuse;
+namespace Org\Mxchange\CoreFramework\Frontend\Fuse;
 
 // Import framework stuff
 use Org\Mxchange\CoreFramework\Registry\Registerable;
index 9273cdf2055b408a56e848df39b116bd536fec65..87884e45167f5c0524d3b0d5c68a664150d801da 100644 (file)
@@ -4,7 +4,7 @@ namespace Org\Mxchange\CoreFramework\Helper;
 
 // Import framework stuff
 use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
-use Org\Mxchange\CoreFramework\Database\Frontend\User\UserDatabaseWrapper;
+use Org\Mxchange\CoreFramework\Database\Frontend\User\UserDatabaseFrontend;
 use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
 use Org\Mxchange\CoreFramework\Generic\NullPointerException;
 use Org\Mxchange\CoreFramework\Helper\Template\HelpableTemplate;
@@ -907,7 +907,7 @@ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate {
         * @return      $isUnconfirmed  Whether the user account is unconfirmed
         */
        public function ifUserAccountUnconfirmed () {
-               $isUnconfirmed = ($this->getValueField(UserDatabaseWrapper::DB_COLUMN_USER_STATUS) === FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('user_status_unconfirmed'));
+               $isUnconfirmed = ($this->getValueField(UserDatabaseFrontend::DB_COLUMN_USER_STATUS) === FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('user_status_unconfirmed'));
                return $isUnconfirmed;
        }
 
@@ -917,7 +917,7 @@ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate {
         * @return      $isUnconfirmed  Whether the user account is locked
         */
        public function ifUserAccountLocked () {
-               $isUnconfirmed = ($this->getValueField(UserDatabaseWrapper::DB_COLUMN_USER_STATUS) === FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('user_status_locked'));
+               $isUnconfirmed = ($this->getValueField(UserDatabaseFrontend::DB_COLUMN_USER_STATUS) === FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('user_status_locked'));
                return $isUnconfirmed;
        }
 
@@ -927,7 +927,7 @@ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate {
         * @return      $isUnconfirmed  Whether the user account is a guest
         */
        public function ifUserAccountGuest () {
-               $isUnconfirmed = ($this->getValueField(UserDatabaseWrapper::DB_COLUMN_USER_STATUS) === FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('user_status_guest'));
+               $isUnconfirmed = ($this->getValueField(UserDatabaseFrontend::DB_COLUMN_USER_STATUS) === FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('user_status_guest'));
                return $isUnconfirmed;
        }
 
index e26856ad240f0b512a3c3930c6943f9c2d59e6a2..5370599b1d9d7aabcef5f83f4492ba7588c8917a 100644 (file)
@@ -5,7 +5,7 @@ namespace Org\Mxchange\CoreFramework\User\Points;
 // Import framework stuff
 use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
 use Org\Mxchange\CoreFramework\Criteria\Storing\StoreableCriteria;
-use Org\Mxchange\CoreFramework\Factory\Database\Wrapper\DatabaseWrapperFactory;
+use Org\Mxchange\CoreFramework\Factory\Database\Frontend\DatabaseFrontendFactory;
 use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
 use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem;
 use Org\Mxchange\CoreFramework\Registry\Registerable;
@@ -72,14 +72,14 @@ class UserPoints extends BaseFrameworkSystem implements Registerable, BookablePo
                $searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class');
 
                // Add search criteria
-               $searchInstance->addCriteria(UserPointsDatabaseWrapper::DB_COLUMN_POINTS_UID, $userInstance->getUserId());
+               $searchInstance->addCriteria(UserPointsDatabaseFrontend::DB_COLUMN_POINTS_UID, $userInstance->getUserId());
                $searchInstance->setLimit(1);
 
-               // Get a wrapper instance
-               $wrapperInstance = DatabaseWrapperFactory::createWrapperByConfiguredName('user_points_db_wrapper_class');
+               // Get a frontend instance
+               $frontendInstance = DatabaseFrontendFactory::createFrontendByConfiguredName('user_points_db_frontend_class');
 
                // Get result back
-               $resultInstance = $wrapperInstance->doSelectByCriteria($searchInstance);
+               $resultInstance = $frontendInstance->doSelectByCriteria($searchInstance);
 
                // Advance to first entry by default
                $resultInstance->next();
@@ -156,19 +156,19 @@ class UserPoints extends BaseFrameworkSystem implements Registerable, BookablePo
                        $currentEntry = $this->getResultInstance()->current();
 
                        // Add the points
-                       $amount += $currentEntry[UserPointsDatabaseWrapper::DB_COLUMN_POINTS];
+                       $amount += $currentEntry[UserPointsDatabaseFrontend::DB_COLUMN_POINTS];
 
                        // Now get another criteria
                        $updateInstance = ObjectFactory::createObjectByConfiguredName('update_criteria_class');
 
                        // And add our both entries
-                       $updateInstance->addCriteria(UserPointsDatabaseWrapper::DB_COLUMN_POINTS, $amount);
+                       $updateInstance->addCriteria(UserPointsDatabaseFrontend::DB_COLUMN_POINTS, $amount);
 
                        // Add the search criteria for searching for the right entry
                        $updateInstance->setSearchInstance($searchInstance);
 
-                       // Set wrapper class name
-                       $updateInstance->setWrapperConfigEntry('user_points_db_wrapper_class');
+                       // Set frontend class name
+                       $updateInstance->setFrontendConfigEntry('user_points_db_frontend_class');
 
                        // Remember the update in database result
                        $this->getResultInstance()->add2UpdateQueue($updateInstance);
@@ -177,7 +177,7 @@ class UserPoints extends BaseFrameworkSystem implements Registerable, BookablePo
                        $this->setAmount($amount);
 
                        // Create the new entry
-                       $wrapperInstance->insertUserPoints($this);
+                       $frontendInstance->insertUserPoints($this);
                }
        }
 
@@ -190,10 +190,10 @@ class UserPoints extends BaseFrameworkSystem implements Registerable, BookablePo
         */
        public function addElementsToDataSet (StoreableCriteria $criteriaInstance) {
                // Add user id
-               $criteriaInstance->addCriteria(UserPointsDatabaseWrapper::DB_COLUMN_POINTS_UID, $this->getUserInstance()->getUserId());
+               $criteriaInstance->addCriteria(UserPointsDatabaseFrontend::DB_COLUMN_POINTS_UID, $this->getUserInstance()->getUserId());
 
                // Add amount
-               $criteriaInstance->addCriteria(UserPointsDatabaseWrapper::DB_COLUMN_POINTS, $this->getAmount());
+               $criteriaInstance->addCriteria(UserPointsDatabaseFrontend::DB_COLUMN_POINTS, $this->getAmount());
        }
 
 }
index 0f19c0aed67630bde663c24524b03b6eccad7ef4..d738aaa8a68750299e56fc5faf8fff4d1372fa0f 100644 (file)
@@ -4,7 +4,7 @@ namespace Org\Mxchange\CoreFramework\Reader\News\Console;
 
 // Import framework stuff
 use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
-use Org\Mxchange\CoreFramework\Factory\Database\Wrapper\DatabaseWrapperFactory;
+use Org\Mxchange\CoreFramework\Factory\Database\Frontend\DatabaseFrontendFactory;
 use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
 use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem;
 use Org\Mxchange\CoreFramework\Reader\News\ReadableNews;
@@ -72,8 +72,8 @@ class ConsoleNewsReader extends BaseFrameworkSystem implements ReadableNews, Reg
                // Get 'command' for saving some calls
                $command = FrameworkBootstrap::getRequestInstance()->getRequestElement('command');
 
-               // First get a wrapper instance
-               $wrapperInstance = DatabaseWrapperFactory::createWrapperByConfiguredName('news_db_wrapper_class');
+               // First get a frontend instance
+               $frontendInstance = DatabaseFrontendFactory::createFrontendByConfiguredName('news_db_frontend_class');
 
                // Next create a searchable criteria instance
                $criteriaInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class');
@@ -85,7 +85,7 @@ class ConsoleNewsReader extends BaseFrameworkSystem implements ReadableNews, Reg
                $criteriaInstance->setConfiguredLimit('news_' . $command . '_limit');
 
                // Get a resultInstance back from the database
-               $resultInstance = $wrapperInstance->doSelectByCriteria($criteriaInstance);
+               $resultInstance = $frontendInstance->doSelectByCriteria($criteriaInstance);
 
                // Save that resultInstance in this class
                $this->setResultInstance($resultInstance);
index 8d67d32eb5b2e9e6e5a1aff618503878b1cfc5c4..d17a7fe956d7ac1b5c638b6cdb9df552ad983d54 100644 (file)
@@ -4,7 +4,7 @@ namespace Org\Mxchange\CoreFramework\Reader\News;
 
 // Import framework stuff
 use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
-use Org\Mxchange\CoreFramework\Factory\Database\Wrapper\DatabaseWrapperFactory;
+use Org\Mxchange\CoreFramework\Factory\Database\Frontend\DatabaseFrontendFactory;
 use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
 use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem;
 use Org\Mxchange\CoreFramework\Registry\Registerable;
@@ -71,8 +71,8 @@ class DefaultNewsReader extends BaseFrameworkSystem implements ReadableNews, Reg
                // Get 'command' for saving some calls
                $command = FrameworkBootstrap::getRequestInstance()->getRequestElement('command');
 
-               // First get a wrapper instance
-               $wrapperInstance = DatabaseWrapperFactory::createWrapperByConfiguredName('news_db_wrapper_class');
+               // First get a frontend instance
+               $frontendInstance = DatabaseFrontendFactory::createFrontendByConfiguredName('news_db_frontend_class');
 
                // Next create a searchable criteria instance
                $criteriaInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class');
@@ -84,7 +84,7 @@ class DefaultNewsReader extends BaseFrameworkSystem implements ReadableNews, Reg
                $criteriaInstance->setConfiguredLimit('news_' . $command . '_limit');
 
                // Get a resultInstance back from the database
-               $resultInstance = $wrapperInstance->doSelectByCriteria($criteriaInstance);
+               $resultInstance = $frontendInstance->doSelectByCriteria($criteriaInstance);
 
                // Save that resultInstance in this class
                $this->setResultInstance($resultInstance);
index f3da469e25f1b6445c98def6dcc4ae32ebe8325a..1a2da22ed2f91654659e391d0cd594eace12d347 100644 (file)
@@ -4,7 +4,7 @@ namespace Org\Mxchange\CoreFramework\User;
 
 // Import framework stuff
 use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
-use Org\Mxchange\CoreFramework\Database\Frontend\User\UserDatabaseWrapper;
+use Org\Mxchange\CoreFramework\Database\Frontend\User\UserDatabaseFrontend;
 use Org\Mxchange\CoreFramework\Database\Updateable;
 use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
 use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem;
@@ -139,21 +139,21 @@ abstract class BaseUser extends BaseFrameworkSystem implements Updateable {
 
                // Is a previous result there?
                if (!$this->getResultInstance() instanceof SearchableResult) {
-                       // Get a UserDatabaseWrapper instance
-                       $wrapperInstance = ObjectFactory::createObjectByConfiguredName('user_db_wrapper_class');
+                       // Get a UserDatabaseFrontend instance
+                       $frontendInstance = ObjectFactory::createObjectByConfiguredName('user_db_frontend_class');
 
                        // Create a search criteria
                        $criteriaInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class');
 
                        // Add the username as a criteria and set limit to one entry
-                       $criteriaInstance->addCriteria(UserDatabaseWrapper::DB_COLUMN_USERNAME, $this->getUserName());
+                       $criteriaInstance->addCriteria(UserDatabaseFrontend::DB_COLUMN_USERNAME, $this->getUserName());
                        $criteriaInstance->setLimit(1);
 
                        // Get a search result
-                       $resultInstance = $wrapperInstance->doSelectByCriteria($criteriaInstance);
+                       $resultInstance = $frontendInstance->doSelectByCriteria($criteriaInstance);
 
                        // Set the index "solver"
-                       $resultInstance->solveResultIndex(UserDatabaseWrapper::DB_COLUMN_USERID, $wrapperInstance, array($this, 'setUserId'));
+                       $resultInstance->solveResultIndex(UserDatabaseFrontend::DB_COLUMN_USERID, $frontendInstance, array($this, 'setUserId'));
 
                        // And finally set it
                        $this->setResultInstance($resultInstance);
@@ -183,21 +183,21 @@ abstract class BaseUser extends BaseFrameworkSystem implements Updateable {
 
                // Is a previous result there?
                if (!$this->getResultInstance() instanceof SearchableResult) {
-                       // Get a UserDatabaseWrapper instance
-                       $wrapperInstance = ObjectFactory::createObjectByConfiguredName('user_db_wrapper_class');
+                       // Get a UserDatabaseFrontend instance
+                       $frontendInstance = ObjectFactory::createObjectByConfiguredName('user_db_frontend_class');
 
                        // Create a search criteria
                        $criteriaInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class');
 
                        // Add the username as a criteria and set limit to one entry
-                       $criteriaInstance->addCriteria(UserDatabaseWrapper::DB_COLUMN_EMAIL, $this->getEmail());
+                       $criteriaInstance->addCriteria(UserDatabaseFrontend::DB_COLUMN_EMAIL, $this->getEmail());
                        $criteriaInstance->setLimit(1);
 
                        // Get a search result
-                       $resultInstance = $wrapperInstance->doSelectByCriteria($criteriaInstance);
+                       $resultInstance = $frontendInstance->doSelectByCriteria($criteriaInstance);
 
                        // Set the index "solver"
-                       $resultInstance->solveResultIndex(UserDatabaseWrapper::DB_COLUMN_USERID, $wrapperInstance, array($this, 'setUserId'));
+                       $resultInstance->solveResultIndex(UserDatabaseFrontend::DB_COLUMN_USERID, $frontendInstance, array($this, 'setUserId'));
 
                        // And finally set it
                        $this->setResultInstance($resultInstance);
@@ -238,21 +238,21 @@ abstract class BaseUser extends BaseFrameworkSystem implements Updateable {
 
                // Is a previous result there?
                if ((!$this->getResultInstance() instanceof SearchableResult) || ($this->getResultInstance()->count() == 0)) {
-                       // Get a UserDatabaseWrapper instance
-                       $wrapperInstance = ObjectFactory::createObjectByConfiguredName('user_db_wrapper_class');
+                       // Get a UserDatabaseFrontend instance
+                       $frontendInstance = ObjectFactory::createObjectByConfiguredName('user_db_frontend_class');
 
                        // Create a search criteria
                        $criteriaInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class');
 
                        // Add the username as a criteria and set limit to one entry
-                       $criteriaInstance->addCriteria(UserDatabaseWrapper::DB_COLUMN_USERNAME, $this->getUserName());
+                       $criteriaInstance->addCriteria(UserDatabaseFrontend::DB_COLUMN_USERNAME, $this->getUserName());
                        $criteriaInstance->setLimit(1);
 
                        // Get a search result
-                       $resultInstance = $wrapperInstance->doSelectByCriteria($criteriaInstance);
+                       $resultInstance = $frontendInstance->doSelectByCriteria($criteriaInstance);
 
                        // Set the index "solver"
-                       $resultInstance->solveResultIndex(UserDatabaseWrapper::DB_COLUMN_USERID, $wrapperInstance, array($this, 'setUserId'));
+                       $resultInstance->solveResultIndex(UserDatabaseFrontend::DB_COLUMN_USERID, $frontendInstance, array($this, 'setUserId'));
 
                        // And finally set it
                        $this->setResultInstance($resultInstance);
@@ -303,11 +303,11 @@ abstract class BaseUser extends BaseFrameworkSystem implements Updateable {
         * @return      $primaryValue   Value of the primary key based on database type
         */
        public final function getPrimaryKey () {
-               // Get a user database wrapper
-               $wrapperInstance = ObjectFactory::createObjectByConfiguredName('user_db_wrapper_class');
+               // Get a user database frontend
+               $frontendInstance = ObjectFactory::createObjectByConfiguredName('user_db_frontend_class');
 
-               // Get the primary key back from the wrapper
-               $primaryKey = $wrapperInstance->getPrimaryKeyValue();
+               // Get the primary key back from the frontend
+               $primaryKey = $frontendInstance->getPrimaryKeyValue();
 
                // Get that field
                $primaryValue = $this->getField($primaryKey);
@@ -329,7 +329,7 @@ abstract class BaseUser extends BaseFrameworkSystem implements Updateable {
                $searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class');
 
                // Add search criteria
-               $searchInstance->addCriteria(UserDatabaseWrapper::DB_COLUMN_USERNAME, $this->getUserName());
+               $searchInstance->addCriteria(UserDatabaseFrontend::DB_COLUMN_USERNAME, $this->getUserName());
                $searchInstance->setLimit(1);
 
                // Now get another criteria
@@ -341,8 +341,8 @@ abstract class BaseUser extends BaseFrameworkSystem implements Updateable {
                // Add the search criteria for searching for the right entry
                $updateInstance->setSearchInstance($searchInstance);
 
-               // Set wrapper class name
-               $updateInstance->setWrapperConfigEntry('user_db_wrapper_class');
+               // Set frontend class name
+               $updateInstance->setFrontendConfigEntry('user_db_frontend_class');
 
                // Remember the update in database result
                $this->getResultInstance()->add2UpdateQueue($updateInstance);
@@ -355,7 +355,7 @@ abstract class BaseUser extends BaseFrameworkSystem implements Updateable {
         */
        public function isConfirmed () {
                // Determine it
-               $isConfirmed = ($this->getField(UserDatabaseWrapper::DB_COLUMN_USER_STATUS) == FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('user_status_confirmed'));
+               $isConfirmed = ($this->getField(UserDatabaseFrontend::DB_COLUMN_USER_STATUS) == FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('user_status_confirmed'));
 
                // Return it
                return $isConfirmed;
@@ -368,7 +368,7 @@ abstract class BaseUser extends BaseFrameworkSystem implements Updateable {
         */
        public function isGuest () {
                // Determine it
-               $isGuest = ($this->getField(UserDatabaseWrapper::DB_COLUMN_USER_STATUS) == FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('user_status_guest'));
+               $isGuest = ($this->getField(UserDatabaseFrontend::DB_COLUMN_USER_STATUS) == FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('user_status_guest'));
 
                // Return it
                return $isGuest;
index 07449e6877958c4762095ec210fd1761030d58b5..f3e204b263af426aa240e705e7c5f8cb24acdef1 100644 (file)
@@ -4,7 +4,7 @@ namespace Org\Mxchange\CoreFramework\User\Login;
 
 // Import framework stuff
 use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
-use Org\Mxchange\CoreFramework\Database\Frontend\User\UserDatabaseWrapper;
+use Org\Mxchange\CoreFramework\Database\Frontend\User\UserDatabaseFrontend;
 use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
 use Org\Mxchange\CoreFramework\Manager\Login\ManageableMember;
 use Org\Mxchange\CoreFramework\Registry\Registerable;
@@ -138,7 +138,7 @@ class Member extends BaseUser implements ManageableMember, Registerable {
                $searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class');
 
                // Add search criteria
-               $searchInstance->addCriteria(UserDatabaseWrapper::DB_COLUMN_USERNAME, $this->getUserName());
+               $searchInstance->addCriteria(UserDatabaseFrontend::DB_COLUMN_USERNAME, $this->getUserName());
                $searchInstance->setLimit(1);
 
                // Now get another criteria
@@ -151,8 +151,8 @@ class Member extends BaseUser implements ManageableMember, Registerable {
                // Add the search criteria for searching for the right entry
                $updateInstance->setSearchInstance($searchInstance);
 
-               // Set wrapper class name
-               $updateInstance->setWrapperConfigEntry('user_db_wrapper_class');
+               // Set frontend class name
+               $updateInstance->setFrontendConfigEntry('user_db_frontend_class');
 
                // Remember the update in database result
                $this->getResultInstance()->add2UpdateQueue($updateInstance);
index 7f1f5121c1f50805f128f9c1337721a8ef11dc7f..017a996752c7539bb4604c644716045c8f271d6e 100644 (file)
@@ -3,7 +3,7 @@
 namespace Org\Mxchange\CoreFramework\Deprecated;
 
 // Import framework stuff
-use Org\Mxchange\CoreFramework\Database\Frontend\User\UserDatabaseWrapper;
+use Org\Mxchange\CoreFramework\Database\Frontend\User\UserDatabaseFrontend;
 use Org\Mxchange\CoreFramework\Generic\FrameworkException;
 
 /**
@@ -43,7 +43,7 @@ class UserNoGuestException extends FrameworkException {
                        $messageArray[0]->__toString(),
                        $this->getLine(),
                        $messageArray[1],
-                       $messageArray[0]->getField(UserDatabaseWrapper::DB_COLUMN_USER_STATUS)
+                       $messageArray[0]->getField(UserDatabaseFrontend::DB_COLUMN_USER_STATUS)
                );
 
                // Make sure everything is assigned properly
index 964d639411b112b6fa9f5693a61d16f8bdab337f..8cbc0b918b7ac0bdcd8b84285147241a7191feee 100644 (file)
@@ -29,19 +29,19 @@ use Org\Mxchange\CoreFramework\Generic\FrameworkInterface;
  */
 interface Criteria extends FrameworkInterface {
        /**
-        * Setter for wrapper class name
+        * Setter for frontend class name
         *
-        * @param       $wrapperConfigEntry             Configuration entry which hold the wrapper class' name
+        * @param       $frontendConfigEntry    Configuration entry which hold the frontend class' name
         * @return      void
         */
-       function setWrapperConfigEntry (string $wrapperConfigEntry);
+       function setFrontendConfigEntry (string $frontendConfigEntry);
 
        /**
-        * Getter for wrapper class name
+        * Getter for Frontend class name
         *
-        * @return      $wrapperConfigEntry             Configuration entry which hold the wrapper class' name
+        * @return      $frontendConfigEntry    Configuration entry which hold the Frontend class' name
         */
-       function getWrapperConfigEntry ();
+       function getFrontendConfigEntry ();
 
        /**
         * Checks whether given key is set
diff --git a/framework/main/interfaces/database/class_DatabaseWrapper.php b/framework/main/interfaces/database/class_DatabaseWrapper.php
deleted file mode 100644 (file)
index 87352f0..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-<?php
-// Own namespace
-namespace Org\Mxchange\CoreFramework\Database\Frontend;
-
-// Import framework stuff
-use Org\Mxchange\CoreFramework\Criteria\Criteria;
-use Org\Mxchange\CoreFramework\Generic\FrameworkInterface;
-
-/**
- * The general interface for all other database wrappers
- *
- * @author             Roland Haeder <webmaster@shipsimu.org>
- * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2020 Core Developer Team
- * @license            GNU GPL 3.0 or any newer version
- * @link               http://www.shipsimu.org
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-interface DatabaseWrapper extends FrameworkInterface {
-       /**
-        * Getter for index key
-        *
-        * @return      $indexKey       Index key
-        */
-       function getIndexKey();
-
-       /**
-        * Getter for last exception
-        *
-        * @return      $lastException  Last exception or NULL if none occured
-        */
-       function getLastException();
-
-       /**
-        * Do a "select" query on the current table with the given search criteria and
-        * store it in cache for later usage
-        *
-        * @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
-        */
-       function doSelectByCriteria(Criteria $criteriaInstance, array $onlyKeys = []);
-
-       /**
-        * Count the numbers of rows we shall receive
-        *
-        * @param       $criteriaInstance       An instance of a Criteria class
-        * @param       $onlyKeys                       Only use these keys for a cache key
-        * @return      $numRows                        Numbers of rows of database entries
-        */
-       function doSelectCountByCriteria(Criteria $criteriaInstance, array $onlyKeys = []);
-
-       /**
-        * Getter for primary key used in wrapped table
-        *
-        * @return      $primaryKey             Primary key used in wrapped table
-        */
-       function getPrimaryKeyValue();
-
-       /**
-        * Counts total rows of this table
-        *
-        * @return      $count  Total rows of this table
-        */
-       function countTotalRows();
-
-}
diff --git a/framework/main/interfaces/database/frontend/account/class_ManageableAccountFrontend.php b/framework/main/interfaces/database/frontend/account/class_ManageableAccountFrontend.php
new file mode 100644 (file)
index 0000000..af1e5bd
--- /dev/null
@@ -0,0 +1,49 @@
+<?php
+// Own namespace
+namespace Org\Mxchange\CoreFramework\Frontend\Account;
+
+// Import framework stuff
+use Org\Mxchange\CoreFramework\Database\Frontend\DatabaseFrontend;
+use Org\Mxchange\CoreFramework\Registration\User\UserRegister;
+use Org\Mxchange\CoreFramework\Result\Update\UpdateableResult;
+
+/**
+ * An interface for frontend handling manageable accounts
+ *
+ * @author             Roland Haeder <webmaster@shipsimu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2020 Core Developer Team
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.shipsimu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+interface ManageableAccountFrontend extends DatabaseFrontend {
+       /**
+        * Handles inserting the registration data from a registration instance into the database
+        *
+        * @param       $registrationInstance   An instance of a registration class
+        * @return      void
+        */
+       function insertRegistrationObject (UserRegister $registrationInstance);
+
+       /**
+        * Updates an user database entry with given result
+        *
+        * @param       $resultInstance         An instance of a UpdateableResult class
+        * @return      void
+        */
+       function doUpdateByResult (UpdateableResult $resultInstance);
+
+}
diff --git a/framework/main/interfaces/database/frontend/class_DatabaseFrontend.php b/framework/main/interfaces/database/frontend/class_DatabaseFrontend.php
new file mode 100644 (file)
index 0000000..d37cbf2
--- /dev/null
@@ -0,0 +1,79 @@
+<?php
+// Own namespace
+namespace Org\Mxchange\CoreFramework\Database\Frontend;
+
+// Import framework stuff
+use Org\Mxchange\CoreFramework\Criteria\Criteria;
+use Org\Mxchange\CoreFramework\Generic\FrameworkInterface;
+
+/**
+ * The general interface for all other database frontends
+ *
+ * @author             Roland Haeder <webmaster@shipsimu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2020 Core Developer Team
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.shipsimu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+interface DatabaseFrontend extends FrameworkInterface {
+       /**
+        * Getter for index key
+        *
+        * @return      $indexKey       Index key
+        */
+       function getIndexKey();
+
+       /**
+        * Getter for last exception
+        *
+        * @return      $lastException  Last exception or NULL if none occured
+        */
+       function getLastException();
+
+       /**
+        * Do a "select" query on the current table with the given search criteria and
+        * store it in cache for later usage
+        *
+        * @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
+        */
+       function doSelectByCriteria(Criteria $criteriaInstance, array $onlyKeys = []);
+
+       /**
+        * Count the numbers of rows we shall receive
+        *
+        * @param       $criteriaInstance       An instance of a Criteria class
+        * @param       $onlyKeys                       Only use these keys for a cache key
+        * @return      $numRows                        Numbers of rows of database entries
+        */
+       function doSelectCountByCriteria(Criteria $criteriaInstance, array $onlyKeys = []);
+
+       /**
+        * Getter for primary key used in wrapped table
+        *
+        * @return      $primaryKey             Primary key used in wrapped table
+        */
+       function getPrimaryKeyValue();
+
+       /**
+        * Counts total rows of this table
+        *
+        * @return      $count  Total rows of this table
+        */
+       function countTotalRows();
+
+}
diff --git a/framework/main/interfaces/database/frontend/user_points/class_BookablePointsFrontend.php b/framework/main/interfaces/database/frontend/user_points/class_BookablePointsFrontend.php
new file mode 100644 (file)
index 0000000..de54acd
--- /dev/null
@@ -0,0 +1,48 @@
+<?php
+// Own namespace
+namespace Org\Mxchange\CoreFramework\Database\Frontend\Points;
+
+// Import framework stuff
+use Org\Mxchange\CoreFramework\Database\Frontend\DatabaseFrontend;
+use Org\Mxchange\CoreFramework\Result\Update\UpdateableResult;
+
+/**
+ * An interface for frontend dealing with bookable points
+ *
+ * @author             Roland Haeder <webmaster@shipsimu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2020 Core Developer Team
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.shipsimu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+interface BookablePointsFrontend extends DatabaseFrontend {
+       /**
+        * Inserts the given points for the given user in the database
+        *
+        * @param       $pointsInstance         An instance of a user class
+        * @return      void
+        */
+       function insertUserPoints (BookablePoints $pointsInstance);
+
+       /**
+        * Updates an user database entry with given result
+        *
+        * @param       $resultInstance         An instance of a UpdateableResult class
+        * @return      void
+        */
+       function doUpdateByResult (UpdateableResult $resultInstance);
+
+}
diff --git a/framework/main/interfaces/database/wrapper/class_BookablePointsWrapper.php b/framework/main/interfaces/database/wrapper/class_BookablePointsWrapper.php
deleted file mode 100644 (file)
index a1c6526..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-<?php
-// Own namespace
-namespace Org\Mxchange\CoreFramework\Database\Frontend\Points;
-
-// Import framework stuff
-use Org\Mxchange\CoreFramework\Database\Frontend\DatabaseWrapper;
-use Org\Mxchange\CoreFramework\Result\Update\UpdateableResult;
-
-/**
- * An interface for wrapper dealing with bookable points
- *
- * @author             Roland Haeder <webmaster@shipsimu.org>
- * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2020 Core Developer Team
- * @license            GNU GPL 3.0 or any newer version
- * @link               http://www.shipsimu.org
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-interface BookablePointsWrapper extends DatabaseWrapper {
-       /**
-        * Inserts the given points for the given user in the database
-        *
-        * @param       $pointsInstance         An instance of a user class
-        * @return      void
-        */
-       function insertUserPoints (BookablePoints $pointsInstance);
-
-       /**
-        * Updates an user database entry with given result
-        *
-        * @param       $resultInstance         An instance of a UpdateableResult class
-        * @return      void
-        */
-       function doUpdateByResult (UpdateableResult $resultInstance);
-
-}
diff --git a/framework/main/interfaces/database/wrapper/class_ManageableAccountWrapper.php b/framework/main/interfaces/database/wrapper/class_ManageableAccountWrapper.php
deleted file mode 100644 (file)
index e22a5c5..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-<?php
-// Own namespace
-namespace Org\Mxchange\CoreFramework\Wrapper\Account;
-
-// Import framework stuff
-use Org\Mxchange\CoreFramework\Database\Frontend\DatabaseWrapper;
-use Org\Mxchange\CoreFramework\Registration\User\UserRegister;
-use Org\Mxchange\CoreFramework\Result\Update\UpdateableResult;
-
-/**
- * An interface for wrapper handling manageable accounts
- *
- * @author             Roland Haeder <webmaster@shipsimu.org>
- * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2020 Core Developer Team
- * @license            GNU GPL 3.0 or any newer version
- * @link               http://www.shipsimu.org
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-interface ManageableAccountWrapper extends DatabaseWrapper {
-       /**
-        * Handles inserting the registration data from a registration instance into the database
-        *
-        * @param       $registrationInstance   An instance of a registration class
-        * @return      void
-        */
-       function insertRegistrationObject (UserRegister $registrationInstance);
-
-       /**
-        * Updates an user database entry with given result
-        *
-        * @param       $resultInstance         An instance of a UpdateableResult class
-        * @return      void
-        */
-       function doUpdateByResult (UpdateableResult $resultInstance);
-
-}
index 03c846da6bbb820845252064956893636338eeba..d0925cc5203aab8aa1d007ba58d13b6c1a23e994 100644 (file)
@@ -4,7 +4,7 @@ namespace Org\Mxchange\CoreFramework\Result\Search;
 
 // Import framework stuff
 use Org\Mxchange\CoreFramework\Criteria\Local\LocalSearchCriteria;
-use Org\Mxchange\CoreFramework\Database\Frontend\DatabaseWrapper;
+use Org\Mxchange\CoreFramework\Database\Frontend\DatabaseFrontend;
 use Org\Mxchange\CoreFramework\Generic\FrameworkInterface;
 
 /**
@@ -45,6 +45,6 @@ interface SearchableResult extends FrameworkInterface {
         * @para        $callBack                       Call-back object for setting the index
         * @return      void
         */
-       function solveResultIndex ($databaseColumn, DatabaseWrapper $wrapperInstance, array $callBack);
+       function solveResultIndex ($databaseColumn, DatabaseFrontend $frontendInstance, array $callBack);
 
 }
diff --git a/framework/main/traits/database/frontend/class_DatabaseFrontendTrait.php b/framework/main/traits/database/frontend/class_DatabaseFrontendTrait.php
new file mode 100644 (file)
index 0000000..9ac1ecd
--- /dev/null
@@ -0,0 +1,55 @@
+<?php
+// Own namespace
+namespace Org\Mxchange\CoreFramework\Traits\Database\Frontend;
+
+// Import framework stuff
+use Org\Mxchange\CoreFramework\Database\Frontend\DatabaseFrontend;
+
+/**
+ * A trait for database frontend
+ *
+ * @author             Roland Haeder <webmaster@shipsimu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2020 Core Developer Team
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.shipsimu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+trait DatabaseFrontendTrait {
+       /**
+        * An instance of a DatabaseFrontend class
+        */
+       private $frontendInstance = NULL;
+
+       /**
+        * Setter for DatabaseFrontend instance
+        *
+        * @param       $frontendInstance       An instance of a DatabaseFrontend class
+        * @return      void
+        */
+       public final function setFrontendInstance (DatabaseFrontend $frontendInstance) {
+               $this->frontendInstance = $frontendInstance;
+       }
+
+       /**
+        * Getter for DatabaseFrontend instance
+        *
+        * @return      $frontendInstance       An instance of a DatabaseFrontend class
+        */
+       public final function getFrontendInstance () {
+               return $this->frontendInstance;
+       }
+
+}