]> git.mxchange.org Git - core.git/blobdiff - framework/main/classes/database/backend/lfdb_legacy/class_CachedLocalFileDatabase.php
Continued:
[core.git] / framework / main / classes / database / backend / lfdb_legacy / class_CachedLocalFileDatabase.php
index b4b547599b66e7346b6eab36f98ed9d2200947b8..be670d26fd493bfb487c09d08be26bd2b2f11152 100644 (file)
@@ -11,6 +11,7 @@ use Org\Mxchange\CoreFramework\Database\Backend\DatabaseBackend;
 use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
 use Org\Mxchange\CoreFramework\Filesystem\FileNotFoundException;
 use Org\Mxchange\CoreFramework\Generic\FrameworkException;
+use Org\Mxchange\CoreFramework\Handler\Stream\IoHandler;
 
 // Import SPL stuff
 use \SplFileInfo;
@@ -74,6 +75,11 @@ class CachedLocalFileDatabase extends BaseDatabaseBackend implements DatabaseBac
         */
        private $indexKey = '__idx';
 
+       /**
+        * The file I/O instance for the template loader
+        */
+       private $fileIoInstance = NULL;
+
        /**
         * The protected constructor. Do never instance from outside! You need to
         * set a local file path. The class will then validate it.
@@ -171,6 +177,24 @@ class CachedLocalFileDatabase extends BaseDatabaseBackend implements DatabaseBac
        public final function getIndexKey () {
                return $this->indexKey;
        }
+       /**
+        * Private getter for file IO instance
+        *
+        * @return      $fileIoInstance         An instance to the file I/O sub-system
+        */
+       protected final function getFileIoInstance () {
+               return $this->fileIoInstance;
+       }
+
+       /**
+        * Setter for file I/O instance
+        *
+        * @param       $fileIoInstance         An instance to the file I/O sub-system
+        * @return      void
+        */
+       public final function setFileIoInstance (IoHandler $fileIoInstance) {
+               $this->fileIoInstance = $fileIoInstance;
+       }
 
        /**
         * Reads a local data file  and returns it's contents in an array
@@ -248,7 +272,7 @@ class CachedLocalFileDatabase extends BaseDatabaseBackend implements DatabaseBac
         * @param       $rowName                        Name of the row
         * @return      $infoInstance           An instance of a SplFileInfo class
         */
-       private function generateFileFromDataSet (Criteria $dataSetInstance, $rowName) {
+       private function generateFileFromDataSet (Criteria $dataSetInstance, string $rowName) {
                // Instanciate new file object
                $infoInstance = new SplFileInfo($this->getConfigInstance()->getConfigEntry('local_database_path') . $dataSetInstance->getTableName() . DIRECTORY_SEPARATOR . $rowName . '.' . $this->getFileExtension());
 
@@ -352,7 +376,7 @@ class CachedLocalFileDatabase extends BaseDatabaseBackend implements DatabaseBac
         * @throws      UnsupportedCriteriaException    If the criteria is unsupported
         * @throws      SqlException                                    If an 'SQL error' occurs
         */
-       public function querySelect ($tableName, LocalSearchCriteria $searchInstance) {
+       public function querySelect (string $tableName, LocalSearchCriteria $searchInstance) {
                // The result is null by any errors
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('CACHED-LFDB: tableName=%s,searchInstance=%s - CALLED!', $tableName, $searchInstance->__toString()));
                $resultData = NULL;
@@ -628,7 +652,7 @@ class CachedLocalFileDatabase extends BaseDatabaseBackend implements DatabaseBac
         * @return      $primaryKey             Primary key column of the given table
         * @todo        Rename method to getPrimaryKeyFromTableInfo()
         */
-       public function getPrimaryKeyOfTable ($tableName) {
+       public function getPrimaryKeyOfTable (string $tableName) {
                // Default key is null
                $primaryKey = NULL;
 
@@ -664,7 +688,7 @@ class CachedLocalFileDatabase extends BaseDatabaseBackend implements DatabaseBac
         * @param       $tableName      Table name
         * @return      $count          Total rows of given table
         */
-       public function countTotalRows($tableName) {
+       public function countTotalRows (string $tableName) {
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CACHED-LFDB: tableName=' . $tableName . ' - CALLED!');
 
                // Create full path name