From 50a5a61a62855fb59a50feb0070205c8cb45dfb8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sun, 26 Feb 2023 15:21:00 +0100 Subject: [PATCH] Continued: - DatabaseConnection::createDatabaseConnection() now only needs a backend class - added some debug lines - added some checks on parameter --- .../bootstrap/class_FrameworkBootstrap.php | 2 +- .../class_CachedLocalFileDatabase.php | 11 +- .../frontend/class_BaseDatabaseFrontend.php | 84 ++++++------ .../result/class_CachedDatabaseResult.php | 122 ++++++++++-------- .../feature/class_FrameworkFeature.php | 18 +-- .../file_directories/class_BaseFileIo.php | 32 +++-- .../text/output/class_BaseOutputTextFile.php | 17 ++- .../classes/utils/arrays/class_ArrayUtils.php | 2 +- .../interfaces/class_FrameworkInterface.php | 1 + .../middleware/class_DatabaseConnector.php | 8 -- .../database/class_DatabaseConnection.php | 116 +++++++++++++---- .../middleware/io/class_FileIoHandler.php | 8 +- 12 files changed, 258 insertions(+), 163 deletions(-) diff --git a/framework/bootstrap/class_FrameworkBootstrap.php b/framework/bootstrap/class_FrameworkBootstrap.php index f58a492d..004b4c6f 100644 --- a/framework/bootstrap/class_FrameworkBootstrap.php +++ b/framework/bootstrap/class_FrameworkBootstrap.php @@ -458,7 +458,7 @@ final class FrameworkBootstrap { $databaseInstance = ObjectFactory::createObjectByConfiguredName(self::getConfigurationInstance()->getConfigEntry('database_type') . '_class'); // Prepare database instance - $connectionInstance = DatabaseConnection::createDatabaseConnection(DebugMiddleware::getSelfInstance(), $databaseInstance); + $connectionInstance = DatabaseConnection::createDatabaseConnection($databaseInstance); // Set it in application helper //* NOISY-DEBUG: */ printf('[%s:%d]: Setting connectionInstance=%s ...' . PHP_EOL, __METHOD__, __LINE__, $connectionInstance->__toString()); diff --git a/framework/main/classes/database/backend/lfdb_legacy/class_CachedLocalFileDatabase.php b/framework/main/classes/database/backend/lfdb_legacy/class_CachedLocalFileDatabase.php index 25225398..a779a16d 100644 --- a/framework/main/classes/database/backend/lfdb_legacy/class_CachedLocalFileDatabase.php +++ b/framework/main/classes/database/backend/lfdb_legacy/class_CachedLocalFileDatabase.php @@ -278,11 +278,11 @@ class CachedLocalFileDatabase extends BaseDatabaseBackend implements DatabaseBac $infoInstance = $this->generateFileFromDataSet($dataSetInstance, 'info'); // Get the data out from dataset in a local array - $this->tableInfo[$dataSetInstance->getTableName()] = array( + $this->tableInfo[$dataSetInstance->getTableName()] = [ 'primary' => $dataSetInstance->getPrimaryKey(), 'created' => time(), - 'last_updated' => time() - ); + 'last_updated' => time(), + ]; // Write the data to the file $this->writeDataArrayToFqfn($infoInstance, $this->tableInfo[$dataSetInstance->getTableName()]); @@ -389,8 +389,9 @@ class CachedLocalFileDatabase extends BaseDatabaseBackend implements DatabaseBac // Initialize the result data, this need to be rewritten e.g. if a local file cannot be read $resultData = [ - BaseDatabaseResult::RESULT_NAME_STATUS => self::RESULT_OKAY, - BaseDatabaseResult::RESULT_NAME_ROWS => [] + BaseDatabaseResult::RESULT_NAME_STATUS => self::RESULT_OKAY, + BaseDatabaseResult::RESULT_NAME_ROWS => [], + BaseDatabaseResult::RESULT_NAME_EXCEPTION => NULL, ]; // Initialize limit/skip diff --git a/framework/main/classes/database/frontend/class_BaseDatabaseFrontend.php b/framework/main/classes/database/frontend/class_BaseDatabaseFrontend.php index 3c7d974f..07f8a313 100644 --- a/framework/main/classes/database/frontend/class_BaseDatabaseFrontend.php +++ b/framework/main/classes/database/frontend/class_BaseDatabaseFrontend.php @@ -58,14 +58,14 @@ abstract class BaseDatabaseFrontend extends BaseFrameworkSystem { */ protected function __construct (string $className) { // Call parent constructor - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-DATABASE-FRONTEND: CONSTRUCTED!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-DATABASE-FRONTEND: className=%s - CONSTRUCTED!', $className)); parent::__construct($className); // Initialize the cache instance $this->initCacheInstance(); // Trace message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-DATABASE-FRONTEND: EXIT!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('BASE-DATABASE-FRONTEND: EXIT!'); } /** @@ -75,18 +75,18 @@ abstract class BaseDatabaseFrontend extends BaseFrameworkSystem { */ private final function initCacheInstance () { // Set "cache" attributes - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-DATABASE-FRONTEND: CALLED!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('BASE-DATABASE-FRONTEND: CALLED!'); $this->databaseCacheEnabled = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('database_cache_enabled'); // Is the cache enabled? - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-DATABASE-FRONTEND: this->databaseCacheEnabled=%d', intval($this->databaseCacheEnabled))); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('BASE-DATABASE-FRONTEND: this->databaseCacheEnabled=%d', intval($this->databaseCacheEnabled))); if ($this->databaseCacheEnabled === true) { // Set the new instance $this->setCacheInstance(ObjectFactory::createObjectByConfiguredName('cache_class')); } // Trace message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-DATABASE-FRONTEND: EXIT!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('BASE-DATABASE-FRONTEND: EXIT!'); } /** @@ -117,14 +117,14 @@ abstract class BaseDatabaseFrontend extends BaseFrameworkSystem { */ protected function getCacheKeyByCriteria (Criteria $criteriaInstance, array $onlyKeys = []) { // Generate it - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-DATABASE-FRONTEND: criteriaInstance=%s,onlyKeys()=%d - CALLED!', $criteriaInstance->__toString(), count($onlyKeys))); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-DATABASE-FRONTEND: criteriaInstance=%s,onlyKeys()=%d - CALLED!', $criteriaInstance->__toString(), count($onlyKeys))); $cacheKey = sprintf('%s@%s', $this->__toString(), $criteriaInstance->getCacheKey($onlyKeys) ); // And return it - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-FRAMEWORK-SYSTEM: cacheKey=' . $cacheKey . ' - EXIT!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('BASE-FRAMEWORK-SYSTEM: cacheKey=' . $cacheKey . ' - EXIT!'); return $cacheKey; } @@ -137,22 +137,22 @@ abstract class BaseDatabaseFrontend extends BaseFrameworkSystem { */ protected function queryInsertDataSet (StoreableCriteria $dataSetInstance, array $onlyKeys = []) { // Default cache key is NULL - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-DATABASE-FRONTEND: dataSetInstance=%s,onlyKeys()=%d - CALLED!', $dataSetInstance->__toString(), count($onlyKeys))); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-DATABASE-FRONTEND: dataSetInstance=%s,onlyKeys()=%d - CALLED!', $dataSetInstance->__toString(), count($onlyKeys))); $cacheKey = NULL; // Is cache enabled? - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-DATABASE-FRONTEND: this->databaseCacheEnabled=%d', intval($this->databaseCacheEnabled))); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('BASE-DATABASE-FRONTEND: this->databaseCacheEnabled=%d', intval($this->databaseCacheEnabled))); if ($this->databaseCacheEnabled === 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(sprintf('BASE-DATABASE-FRONTEND: Using cache key %s for purging ...', $cacheKey)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('BASE-DATABASE-FRONTEND: Using cache key %s for purging ...', $cacheKey)); } // Does this key exists in cache? - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-DATABASE-FRONTEND: this->databaseCacheEnabled=%d,cacheKey[%s]=%s', intval($this->databaseCacheEnabled), gettype($cacheKey), $cacheKey)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('BASE-DATABASE-FRONTEND: this->databaseCacheEnabled=%d,cacheKey[%s]=%s', intval($this->databaseCacheEnabled), gettype($cacheKey), $cacheKey)); if (($this->databaseCacheEnabled === true) && ($this->getCacheInstance()->offsetExists($cacheKey))) { // Purge the cache - //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-DATABASE-FRONTEND: Invoking this->cacheInstance->purgeOffset(%s) ...', $cacheKey)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('BASE-DATABASE-FRONTEND: Invoking this->cacheInstance->purgeOffset(%s) ...', $cacheKey)); $this->getCacheInstance()->purgeOffset($cacheKey); } @@ -160,7 +160,7 @@ abstract class BaseDatabaseFrontend extends BaseFrameworkSystem { FrameworkBootstrap::getDatabaseInstance()->queryInsertDataSet($dataSetInstance); // Trace message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-DATABASE-FRONTEND: EXIT!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('BASE-DATABASE-FRONTEND: EXIT!'); } /** @@ -172,19 +172,19 @@ abstract class BaseDatabaseFrontend extends BaseFrameworkSystem { */ protected function queryUpdateDataSet (StoreableCriteria $dataSetInstance, array $onlyKeys = []) { // Init cache key - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-DATABASE-FRONTEND: dataSetInstance=%s,onlyKeys()=%d - CALLED!', $dataSetInstance->__toString(), count($onlyKeys))); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-DATABASE-FRONTEND: dataSetInstance=%s,onlyKeys()=%d - CALLED!', $dataSetInstance->__toString(), count($onlyKeys))); $cacheKey = NULL; // Is cache enabled? - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-DATABASE-FRONTEND: this->databaseCacheEnabled=%d', intval($this->databaseCacheEnabled))); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('BASE-DATABASE-FRONTEND: this->databaseCacheEnabled=%d', intval($this->databaseCacheEnabled))); if ($this->databaseCacheEnabled === 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-DATABASE-FRONTEND: Using cache key ' . $cacheKey . ' for purging ...'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage('BASE-DATABASE-FRONTEND: Using cache key ' . $cacheKey . ' for purging ...'); } // Does this key exists in cache? - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-DATABASE-FRONTEND: this->databaseCacheEnabled=%d,cacheKey=%s', intval($this->databaseCacheEnabled), $cacheKey)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('BASE-DATABASE-FRONTEND: this->databaseCacheEnabled=%d,cacheKey=%s', intval($this->databaseCacheEnabled), $cacheKey)); if (($this->databaseCacheEnabled === true) && ($this->getCacheInstance()->offsetExists($cacheKey))) { // Purge the cache $this->getCacheInstance()->purgeOffset($cacheKey); @@ -194,7 +194,7 @@ abstract class BaseDatabaseFrontend extends BaseFrameworkSystem { FrameworkBootstrap::getDatabaseInstance()->queryUpdateDataSet($dataSetInstance); // Trace message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-DATABASE-FRONTEND: EXIT!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('BASE-DATABASE-FRONTEND: EXIT!'); } /** @@ -203,7 +203,7 @@ abstract class BaseDatabaseFrontend extends BaseFrameworkSystem { * @return $indexKey Index key */ public final function getIndexKey () { - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-DATABASE-FRONTEND: CALLED!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('BASE-DATABASE-FRONTEND: CALLED!'); return FrameworkBootstrap::getDatabaseInstance()->getIndexKey(); } @@ -213,7 +213,7 @@ abstract class BaseDatabaseFrontend extends BaseFrameworkSystem { * @return $lastException Last exception or NULL if none occured */ public final function getLastException () { - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-DATABASE-FRONTEND: CALLED!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('BASE-DATABASE-FRONTEND: CALLED!'); return FrameworkBootstrap::getDatabaseInstance()->getLastException(); } @@ -227,54 +227,54 @@ abstract class BaseDatabaseFrontend extends BaseFrameworkSystem { */ public function doSelectByCriteria (Criteria $criteriaInstance, array $onlyKeys = []) { // Default cache key if cache is not enabled - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-DATABASE-FRONTEND: criteriaInstance=%s,onlyKeys()=%d - CALLED!', $criteriaInstance->__toString(), count($onlyKeys))); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-DATABASE-FRONTEND: criteriaInstance=%s,onlyKeys()=%d - CALLED!', $criteriaInstance->__toString(), count($onlyKeys))); $cacheKey = NULL; $result = []; // Is the cache enabled? - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-DATABASE-FRONTEND: this->databaseCacheEnabled=%d', intval($this->databaseCacheEnabled))); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('BASE-DATABASE-FRONTEND: this->databaseCacheEnabled=%d', intval($this->databaseCacheEnabled))); if ($this->databaseCacheEnabled === true) { // First get a key suitable for our cache and extend it with this class name $cacheKey = $this->getCacheKeyByCriteria($criteriaInstance, $onlyKeys); } // Does this key exists in cache? - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-DATABASE-FRONTEND: this->databaseCacheEnabled=%d,cacheKey[%s]=%s', intval($this->databaseCacheEnabled), gettype($cacheKey), $cacheKey)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('BASE-DATABASE-FRONTEND: this->databaseCacheEnabled=%d,cacheKey[%s]=%s', intval($this->databaseCacheEnabled), gettype($cacheKey), $cacheKey)); if (($this->databaseCacheEnabled === true) && ($this->getCacheInstance()->offsetExists($cacheKey, BaseDatabaseResult::RESULT_NAME_ROWS, 1))) { // Then use this result - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-DATABASE-FRONTEND: Cache used for cacheKey=%s', $cacheKey)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('BASE-DATABASE-FRONTEND: Cache used for cacheKey=%s', $cacheKey)); $result = $this->getCacheInstance()->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-DATABASE-FRONTEND: Quering database, cacheKey=%s ...', $cacheKey)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('BASE-DATABASE-FRONTEND: 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-DATABASE-FRONTEND: result[]=%s', gettype($result))); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('BASE-DATABASE-FRONTEND: result[]=%s', gettype($result))); if (!is_null($result)) { // Is cache enabled? - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-DATABASE-FRONTEND: this->databaseCacheEnabled=%d', intval($this->databaseCacheEnabled))); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('BASE-DATABASE-FRONTEND: this->databaseCacheEnabled=%d', intval($this->databaseCacheEnabled))); if ($this->databaseCacheEnabled === true) { // A valid result has returned from the database layer - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-DATABASE-FRONTEND: Setting cacheKey=%s with result()=%d entries', $cacheKey, count($result))); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('BASE-DATABASE-FRONTEND: Setting cacheKey=%s with result()=%d entries', $cacheKey, count($result))); $this->getCacheInstance()->offsetSet($cacheKey, $result); } } else { // This invalid result must be wrapped - $result = array( + $result = [ BaseDatabaseResult::RESULT_NAME_STATUS => 'invalid', - BaseDatabaseResult::RESULT_NAME_EXCEPTION => FrameworkBootstrap::getDatabaseInstance()->getLastException() - ); + BaseDatabaseResult::RESULT_NAME_EXCEPTION => FrameworkBootstrap::getDatabaseInstance()->getLastException(), + ]; } } // Create an instance of a CachedDatabaseResult class with the given result // @TODO Minor: Update above comment to e.g. BaseDatabaseResult - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-DATABASE-FRONTEND: result[%s]=%s,result[%s]?=%d,result[%s]?=%d', BaseDatabaseResult::RESULT_NAME_STATUS, $result[BaseDatabaseResult::RESULT_NAME_STATUS], BaseDatabaseResult::RESULT_NAME_ROWS, isset($result[BaseDatabaseResult::RESULT_NAME_ROWS]), BaseDatabaseResult::RESULT_NAME_EXCEPTION, isset($result[BaseDatabaseResult::RESULT_NAME_EXCEPTION]))); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('BASE-DATABASE-FRONTEND: result[%s]=%s,result[%s]?=%d,result[%s]?=%d', BaseDatabaseResult::RESULT_NAME_STATUS, $result[BaseDatabaseResult::RESULT_NAME_STATUS], BaseDatabaseResult::RESULT_NAME_ROWS, isset($result[BaseDatabaseResult::RESULT_NAME_ROWS]), BaseDatabaseResult::RESULT_NAME_EXCEPTION, isset($result[BaseDatabaseResult::RESULT_NAME_EXCEPTION]))); $resultInstance = ObjectFactory::createObjectByConfiguredName('database_result_class', array($result)); // And return the instance - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-DATABASE-FRONTEND: resultInstance=%s - EXIT!', $resultInstance->__toString())); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-DATABASE-FRONTEND: resultInstance=%s - EXIT!', $resultInstance->__toString())); return $resultInstance; } @@ -287,21 +287,21 @@ abstract class BaseDatabaseFrontend extends BaseFrameworkSystem { */ public function doSelectCountByCriteria (Criteria $criteriaInstance, array $onlyKeys = []) { // Total numbers is -1 so we can distinglish between failed and valid queries - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-DATABASE-FRONTEND: criteriaInstance=%s,onlyKeys()=%d - CALLED!', $criteriaInstance->__toString(), count($onlyKeys))); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-DATABASE-FRONTEND: criteriaInstance=%s,onlyKeys()=%d - CALLED!', $criteriaInstance->__toString(), count($onlyKeys))); $numRows = 0; // Get the result from above method $resultInstance = $this->doSelectByCriteria($criteriaInstance, $onlyKeys); // Was that query fine? - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-DATABASE-FRONTEND: resultInstance->ifStatusIsOkay()=%d', $resultInstance->ifStatusIsOkay())); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('BASE-DATABASE-FRONTEND: resultInstance->ifStatusIsOkay()=%d', $resultInstance->ifStatusIsOkay())); if ($resultInstance->ifStatusIsOkay()) { // Then get the number of rows $numRows = $resultInstance->getAffectedRows(); } // Return the result - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-DATABASE-FRONTEND: numRows=%d - EXIT!', $numRows)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-DATABASE-FRONTEND: numRows=%d - EXIT!', $numRows)); return $numRows; } @@ -312,11 +312,11 @@ abstract class BaseDatabaseFrontend extends BaseFrameworkSystem { */ public final function generatePrimaryKey () { // Get the table name and a database instance and ask for it - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-DATABASE-FRONTEND: CALLED!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('BASE-DATABASE-FRONTEND: CALLED!'); $primaryKey = FrameworkBootstrap::getDatabaseInstance()->getPrimaryKeyOfTable($this->getTableName()); // Return value - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-DATABASE-FRONTEND: primaryKey=%s - EXIT!', $primaryKey)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-DATABASE-FRONTEND: primaryKey=%s - EXIT!', $primaryKey)); return $primaryKey; } @@ -327,11 +327,11 @@ abstract class BaseDatabaseFrontend extends BaseFrameworkSystem { */ public final function countTotalRows () { // Get the table name and a database instance and ask for it - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-DATABASE-FRONTEND: CALLED!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('BASE-DATABASE-FRONTEND: CALLED!'); $count = FrameworkBootstrap::getDatabaseInstance()->countTotalRows($this->getTableName()); // Return value - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-DATABASE-FRONTEND: count=%d - EXIT!', $count)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-DATABASE-FRONTEND: count=%d - EXIT!', $count)); return $count; } @@ -344,7 +344,7 @@ abstract class BaseDatabaseFrontend extends BaseFrameworkSystem { */ public function removeNonPublicDataFromArray (array $data) { // Check parameter - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-DATABASE-FRONTEND: data()=%d - CALLED!', count($data))); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-DATABASE-FRONTEND: data()=%d - CALLED!', count($data))); if (count($data) == 0) { // Throw IAE throw new InvalidArgumentException('Parameter "data" is an empty array', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); @@ -354,7 +354,7 @@ abstract class BaseDatabaseFrontend extends BaseFrameworkSystem { $data = FrameworkBootstrap::getDatabaseInstance()->removeNonPublicDataFromArray($data); // Return cleaned array - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-DATABASE-FRONTEND: data()=%d - EXIT!', count($data))); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-DATABASE-FRONTEND: data()=%d - EXIT!', count($data))); return $data; } diff --git a/framework/main/classes/database/result/class_CachedDatabaseResult.php b/framework/main/classes/database/result/class_CachedDatabaseResult.php index 3989cb70..c79eabfd 100644 --- a/framework/main/classes/database/result/class_CachedDatabaseResult.php +++ b/framework/main/classes/database/result/class_CachedDatabaseResult.php @@ -81,7 +81,11 @@ class CachedDatabaseResult extends BaseDatabaseResult implements SearchableResul */ private function __construct () { // Call parent constructor + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('CACHED-DATABASE-RESULT: CONSTRUCTED!'); parent::__construct(__CLASS__); + + // Trace message + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('CACHED-DATABASE-RESULT: EXIT!'); } /** @@ -93,25 +97,35 @@ class CachedDatabaseResult extends BaseDatabaseResult implements SearchableResul */ public static final function createCachedDatabaseResult (array $resultArray) { // Misses an element? + //* DEBUG-DIE: */ die(sprintf('[%s:%d]: resultArray=%s', __METHOD__, __LINE__, print_r($resultArray, true))); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('CACHED-DATABASE-RESULT: resultArray()=%d - CALLED!', count($resultArray))); if (count($resultArray) == 0) { // Cannot be empty throw new InvalidArgumentException('Array "resultArray" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (!array_key_exists(BaseDatabaseResult::RESULT_NAME_ROWS, $resultArray)) { // Yes, then abort here throw new InvalidArgumentException(sprintf('resultArray(%d)=%s has no element "%s".', count($resultArray), print_r($resultArray, TRUE), BaseDatabaseResult::RESULT_NAME_ROWS)); + } elseif (!array_key_exists(BaseDatabaseResult::RESULT_NAME_STATUS, $resultArray)) { + // Yes, then abort here + throw new InvalidArgumentException(sprintf('resultArray(%d)=%s has no element "%s".', count($resultArray), print_r($resultArray, TRUE), BaseDatabaseResult::RESULT_NAME_STATUS)); } // Get a new instance $resultInstance = new CachedDatabaseResult(); - // Set the result array and reset current position + // Set the result array + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('CACHED-DATABASE-RESULT: Setting resultArray()=%d ...', count($resultArray))); $resultInstance->setResultArray($resultArray); + + // Reset current position + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('CACHED-DATABASE-RESULT: Invoking resultInstance->resetCurrentPosition() ...'); $resultInstance->resetCurrentPosition(); // Set affected rows $resultInstance->setAffectedRows(count($resultArray[BaseDatabaseResult::RESULT_NAME_ROWS])); // Return the instance + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('CACHED-DATABASE-RESULT: resultInstance=%s - EXIT!', $resultInstance->__toString())); return $resultInstance; } @@ -133,13 +147,13 @@ class CachedDatabaseResult extends BaseDatabaseResult implements SearchableResul */ private function updateCurrentEntryByCriteria (LocalUpdateCriteria $updateInstance) { // Get the current entry key - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('CACHED-DATABASE-RESULT: updateInstance=%s - CALLED!', $updateInstance->__toString())); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('CACHED-DATABASE-RESULT: updateInstance=%s - CALLED!', $updateInstance->__toString())); $entryKey = $this->key(); // Now get the update criteria array and update all entries foreach ($updateInstance->getUpdateCriteria() as $criteriaKey => $criteriaValue) { // Update data - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('CACHED-DATABASE-RESULT: criteriaKey=%s,criteriaValue[%s]=%s', $criteriaKey, gettype($criteriaValue), $criteriaValue)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('CACHED-DATABASE-RESULT: criteriaKey=%s,criteriaValue[%s]=%s', $criteriaKey, gettype($criteriaValue), $criteriaValue)); $this->resultArray[BaseDatabaseResult::RESULT_NAME_ROWS][$entryKey][$criteriaKey] = $criteriaValue; // Mark it as out-dated @@ -147,7 +161,7 @@ class CachedDatabaseResult extends BaseDatabaseResult implements SearchableResul } // Trace message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('CACHED-DATABASE-RESULT: EXIT!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('CACHED-DATABASE-RESULT: EXIT!'); } /** @@ -158,7 +172,7 @@ class CachedDatabaseResult extends BaseDatabaseResult implements SearchableResul */ public function next () { // Default is not valid - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('CACHED-DATABASE-RESULT: CALLED!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('CACHED-DATABASE-RESULT: CALLED!'); $nextValid = false; // Increase position @@ -172,7 +186,7 @@ class CachedDatabaseResult extends BaseDatabaseResult implements SearchableResul } // Return the result - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('CACHED-DATABASE-RESULT: nextValid=%d - EXIT!', intval($nextValid))); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('CACHED-DATABASE-RESULT: nextValid=%d - EXIT!', intval($nextValid))); return $nextValid; } @@ -185,7 +199,7 @@ class CachedDatabaseResult extends BaseDatabaseResult implements SearchableResul */ public function seek (int $seekPosition) { // Validate parameter - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('CACHED-DATABASE-RESULT: seekPosition=%d - CALLED!', $seekPosition)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('CACHED-DATABASE-RESULT: seekPosition=%d - CALLED!', $seekPosition)); if ($seekPosition < 0) { // Throw exception throw new OutOfBoundsException(sprintf('seekPositon=%d is not seekable', $seekPosition)); @@ -195,14 +209,14 @@ class CachedDatabaseResult extends BaseDatabaseResult implements SearchableResul $this->rewind(); // Search for the entry - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('CACHED-DATABASE-RESULT: this->currentPos=%d,seekPosition=%d', $this->currentPos, $seekPosition)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('CACHED-DATABASE-RESULT: this->currentPos=%d,seekPosition=%d', $this->currentPos, $seekPosition)); while (($this->currentPos < $seekPosition) && ($this->valid())) { // Continue on $this->next(); } // Trace message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('CACHED-DATABASE-RESULT: EXIT!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('CACHED-DATABASE-RESULT: EXIT!'); } /** @@ -212,7 +226,7 @@ class CachedDatabaseResult extends BaseDatabaseResult implements SearchableResul */ public function current () { // Default is not found - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('CACHED-DATABASE-RESULT: CALLED!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('CACHED-DATABASE-RESULT: CALLED!'); $current = NULL; // Does the current enty exist? @@ -222,7 +236,7 @@ class CachedDatabaseResult extends BaseDatabaseResult implements SearchableResul } // Return the result - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('CACHED-DATABASE-RESULT: current[]=%s - EXIT!', gettype($current))); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('CACHED-DATABASE-RESULT: current[]=%s - EXIT!', gettype($current))); return $current; } @@ -233,11 +247,11 @@ class CachedDatabaseResult extends BaseDatabaseResult implements SearchableResul */ public function valid () { // Check if all is fine ... - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('CACHED-DATABASE-RESULT: this->currentPos=%d - CALLED!', $this->currentPos)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('CACHED-DATABASE-RESULT: this->currentPos=%d - CALLED!', $this->currentPos)); $isValid = ($this->ifStatusIsOkay() && isset($this->resultArray[BaseDatabaseResult::RESULT_NAME_ROWS][$this->currentPos]) && isset($this->resultArray[BaseDatabaseResult::RESULT_NAME_ROWS][0])); // Return the result - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('CACHED-DATABASE-RESULT: isValid=%d - EXIT!', intval($isValid))); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('CACHED-DATABASE-RESULT: isValid=%d - EXIT!', intval($isValid))); return $isValid; } @@ -248,11 +262,11 @@ class CachedDatabaseResult extends BaseDatabaseResult implements SearchableResul */ public function count () { // Count rows - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('CACHED-DATABASE-RESULT: CALLED!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('CACHED-DATABASE-RESULT: CALLED!'); $count = count($this->resultArray[BaseDatabaseResult::RESULT_NAME_ROWS]); // Return it - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('CACHED-DATABASE-RESULT: count=%d - EXIT!', $count)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('CACHED-DATABASE-RESULT: count=%d - EXIT!', $count)); return $count; } @@ -263,11 +277,11 @@ class CachedDatabaseResult extends BaseDatabaseResult implements SearchableResul */ public function ifStatusIsOkay () { // Check all conditions - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('CACHED-DATABASE-RESULT: this->currentPos=%d - CALLED!', $this->currentPos)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('CACHED-DATABASE-RESULT: this->currentPos=%d - CALLED!', $this->currentPos)); $ifStatusOkay = (isset($this->resultArray[BaseDatabaseResult::RESULT_NAME_STATUS]) && $this->resultArray[BaseDatabaseResult::RESULT_NAME_STATUS] === BaseDatabaseBackend::RESULT_OKAY); // Return status - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('CACHED-DATABASE-RESULT: ifStatusOkay=%s - EXIT!', intval($ifStatusOkay))); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('CACHED-DATABASE-RESULT: ifStatusOkay=%s - EXIT!', intval($ifStatusOkay))); return $ifStatusOkay; } @@ -278,7 +292,7 @@ class CachedDatabaseResult extends BaseDatabaseResult implements SearchableResul */ public function key () { // Return current array position - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('CACHED-DATABASE-RESULT: this->currentPos=%d - CALLED!', $this->currentPos)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('CACHED-DATABASE-RESULT: this->currentPos=%d - CALLED!', $this->currentPos)); return $this->currentPos; } @@ -289,12 +303,12 @@ class CachedDatabaseResult extends BaseDatabaseResult implements SearchableResul */ public function rewind () { // Reset both current array position and current row - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('CACHED-DATABASE-RESULT: this->currentPos=%d - CALLED!', $this->currentPos)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('CACHED-DATABASE-RESULT: this->currentPos=%d - CALLED!', $this->currentPos)); $this->resetCurrentPosition(); $this->currentRow = []; // Trace message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('CACHED-DATABASE-RESULT: EXIT!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('CACHED-DATABASE-RESULT: EXIT!'); } /** @@ -305,11 +319,11 @@ class CachedDatabaseResult extends BaseDatabaseResult implements SearchableResul */ private function resetCurrentPosition () { // Reset position - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('CACHED-DATABASE-RESULT: CALLED!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('CACHED-DATABASE-RESULT: CALLED!'); $this->currentPos = ($this->count() > 0 ? 0 : -1); // Trace message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('CACHED-DATABASE-RESULT: EXIT!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('CACHED-DATABASE-RESULT: this->currentPos=%d - EXIT!', $this->currentPos)); } /** @@ -334,57 +348,57 @@ class CachedDatabaseResult extends BaseDatabaseResult implements SearchableResul */ public function add2UpdateQueue (LocalUpdateCriteria $updateInstance) { // Rewind the pointer - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('CACHED-DATABASE-RESULT: updateInstance=%s - CALLED!', $updateInstance->__toString())); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('CACHED-DATABASE-RESULT: updateInstance=%s - CALLED!', $updateInstance->__toString())); $this->rewind(); // Get search criteria $searchInstance = $updateInstance->getSearchInstance(); // Get affected rows - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('CACHED-DATABASE-RESULT: searchInstance=%s', $searchInstance->__toString())); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('CACHED-DATABASE-RESULT: searchInstance=%s', $searchInstance->__toString())); $foundEntries = $this->getAffectedRows(); // And start looking for the result - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('CACHED-DATABASE-RESULT: foundEntries=%d,searchInstance->limit=%d', $foundEntries, $searchInstance->getLimit())); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('CACHED-DATABASE-RESULT: foundEntries=%d,searchInstance->limit=%d', $foundEntries, $searchInstance->getLimit())); while (($this->valid()) && ($foundEntries < $searchInstance->getLimit())) { // Get next entry - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('CACHED-DATABASE-RESULT: Invoking this->next() ...'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('CACHED-DATABASE-RESULT: Invoking this->next() ...'); $this->next(); // Get current entry - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('CACHED-DATABASE-RESULT: Invoking this->current() ...'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('CACHED-DATABASE-RESULT: Invoking this->current() ...'); $currentEntry = $this->current(); // Is this entry found? - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('CACHED-DATABASE-RESULT: currentEntry[]=%s - EXIT!', gettype($currentEntry))); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('CACHED-DATABASE-RESULT: currentEntry[]=%s - EXIT!', gettype($currentEntry))); if ($searchInstance->ifEntryMatches($currentEntry)) { // Update this entry - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('CACHED-DATABASE-RESULT: Invoking this->updateCurrentEntryByCriteria(%s) ...', $updateInstance->__toString())); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('CACHED-DATABASE-RESULT: Invoking this->updateCurrentEntryByCriteria(%s) ...', $updateInstance->__toString())); $this->updateCurrentEntryByCriteria($updateInstance); // Count one up $foundEntries++; - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('CACHED-DATABASE-RESULT: foundEntries=%d', $foundEntries)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('CACHED-DATABASE-RESULT: foundEntries=%d', $foundEntries)); } } // If no entry is found/updated throw an exception - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('CACHED-DATABASE-RESULT: foundEntries=%d', $foundEntries)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('CACHED-DATABASE-RESULT: foundEntries=%d', $foundEntries)); if ($foundEntries == 0) { // Throw an exception here throw new ResultUpdateException($this, self::EXCEPTION_RESULT_UPDATE_FAILED); } // Set affected rows - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('CACHED-DATABASE-RESULT: Invoking this->setAffectedRows(%d) ...', $foundEntries)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('CACHED-DATABASE-RESULT: Invoking this->setAffectedRows(%d) ...', $foundEntries)); $this->setAffectedRows($foundEntries); // Set update instance - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('CACHED-DATABASE-RESULT: Invoking this->setUpdateInstance(%s) ...', $updateInstance->__toString())); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('CACHED-DATABASE-RESULT: Invoking this->setUpdateInstance(%s) ...', $updateInstance->__toString())); $this->setUpdateInstance($updateInstance); // Trace message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('CACHED-DATABASE-RESULT: EXIT!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('CACHED-DATABASE-RESULT: EXIT!'); } /** @@ -422,11 +436,11 @@ class CachedDatabaseResult extends BaseDatabaseResult implements SearchableResul */ public function ifDataNeedsFlush () { // Check if records are out-dated - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('CACHED-DATABASE-RESULT: CALLED!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('CACHED-DATABASE-RESULT: CALLED!'); $needsUpdate = (count($this->outDated) > 0); // Return it - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('CACHED-DATABASE-RESULT: needsUpdate=%d - EXIT!', intval($needsUpdate))); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('CACHED-DATABASE-RESULT: needsUpdate=%d - EXIT!', intval($needsUpdate))); return $needsUpdate; } @@ -438,19 +452,19 @@ class CachedDatabaseResult extends BaseDatabaseResult implements SearchableResul */ public function addElementsToDataSet (StoreableCriteria $criteriaInstance) { // Walk only through out-dated columns - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('CACHED-DATABASE-RESULT: criteriaInstance=%s - CALLED!', $criteriaInstance->__toString())); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('CACHED-DATABASE-RESULT: criteriaInstance=%s - CALLED!', $criteriaInstance->__toString())); foreach ($this->outDated as $key => $dummy) { // Does this key exist? - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('CACHED-DATABASE-RESULT: key=%s,dummy[]=%s', $key, gettype($dummy))); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('CACHED-DATABASE-RESULT: key=%s,dummy[]=%s', $key, gettype($dummy))); if ($this->find($key)) { // Then update it - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('CACHED-DATABASE-RESULT: Invoking criteriaInstance->addCriteria(%s,foundValue[]=%s) ...', $key, gettype($this->getFoundValue()))); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('CACHED-DATABASE-RESULT: Invoking criteriaInstance->addCriteria(%s,foundValue[]=%s) ...', $key, gettype($this->getFoundValue()))); $criteriaInstance->addCriteria($key, $this->getFoundValue()); } } // Trace message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('CACHED-DATABASE-RESULT: EXIT!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('CACHED-DATABASE-RESULT: EXIT!'); } /** @@ -462,7 +476,7 @@ class CachedDatabaseResult extends BaseDatabaseResult implements SearchableResul */ public function find (string $key) { // Check parameter - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('CACHED-DATABASE-RESULT: key=%s - CALLED!', $key)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('CACHED-DATABASE-RESULT: key=%s - CALLED!', $key)); if (empty($key)) { // Throw IAE throw new InvalidArgumentException('Parameter "key" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); @@ -472,37 +486,37 @@ class CachedDatabaseResult extends BaseDatabaseResult implements SearchableResul $found = false; // Rewind the pointer - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('CACHED-DATABASE-RESULT: Invoking this->rewind() ...'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('CACHED-DATABASE-RESULT: Invoking this->rewind() ...'); $this->rewind(); // Walk through all entries while ($this->valid()) { // Advance to next entry - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('CACHED-DATABASE-RESULT: Invoking this->next() ...'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('CACHED-DATABASE-RESULT: Invoking this->next() ...'); $this->next(); // Get the whole array $currentEntry = $this->current(); // Is the element there? - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('CACHED-DATABASE-RESULT: currentEntry[]=%s - EXIT!', gettype($currentEntry))); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('CACHED-DATABASE-RESULT: currentEntry[]=%s - EXIT!', gettype($currentEntry))); if (isset($currentEntry[$key])) { // Okay, found! - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('CACHED-DATABASE-RESULT: key=%s is found in currentEntry', $key)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('CACHED-DATABASE-RESULT: key=%s is found in currentEntry', $key)); $found = true; // So "cache" it - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('CACHED-DATABASE-RESULT: Setting this->foundValue to currentEntry[%s][]=%s is found in currentEntry', $key, gettype($currentEntry[$key]))); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('CACHED-DATABASE-RESULT: Setting this->foundValue to currentEntry[%s][]=%s is found in currentEntry', $key, gettype($currentEntry[$key]))); $this->foundValue = $currentEntry[$key]; // And stop searching - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage('CACHED-DATABASE-RESULT: BREAK!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage('CACHED-DATABASE-RESULT: BREAK!'); break; } } // Return the result - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('CACHED-DATABASE-RESULT: found=%d - EXIT!', intval($found))); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('CACHED-DATABASE-RESULT: found=%d - EXIT!', intval($found))); return $found; } @@ -519,7 +533,7 @@ class CachedDatabaseResult extends BaseDatabaseResult implements SearchableResul */ public function solveResultIndex (string $databaseColumn, DatabaseFrontend $frontendInstance, array $callback) { // Check parameter - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('CACHED-DATABASE-RESULT: databaseColumn=%s,frontendInstance=%s,callback()=%d - CALLED!', $databaseColumn, $frontendInstance->__toString(), count($callback))); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('CACHED-DATABASE-RESULT: databaseColumn=%s,frontendInstance=%s,callback()=%d - CALLED!', $databaseColumn, $frontendInstance->__toString(), count($callback))); if (empty($key)) { // Throw IAE throw new InvalidArgumentException('Parameter "key" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); @@ -535,23 +549,23 @@ class CachedDatabaseResult extends BaseDatabaseResult implements SearchableResul $indexValue = 0; // Is the element in result itself found? - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('CACHED-DATABASE-RESULT: Invoking this->find(%s),frontendInstance->indexKey=%s ...', $databaseColumn, $frontendInstance->getIndexKey())); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('CACHED-DATABASE-RESULT: Invoking this->find(%s),frontendInstance->indexKey=%s ...', $databaseColumn, $frontendInstance->getIndexKey())); if ($this->find($databaseColumn)) { // Use this value $indexValue = $this->getFoundValue(); - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('CACHED-DATABASE-RESULT: indexValue[]=%s from this->find(%s) - databaseColumn', gettype($indexValue), $databaseColumn)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('CACHED-DATABASE-RESULT: indexValue[]=%s from this->find(%s) - databaseColumn', gettype($indexValue), $databaseColumn)); } elseif ($this->find($frontendInstance->getIndexKey())) { // Use this value $indexValue = $this->getFoundValue(); - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('CACHED-DATABASE-RESULT: indexValue[]=%s from this->find(%s) - frontendInstance->indexKey', gettype($indexValue), $frontendInstance->getIndexKey())); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('CACHED-DATABASE-RESULT: indexValue[]=%s from this->find(%s) - frontendInstance->indexKey', gettype($indexValue), $frontendInstance->getIndexKey())); } // Set the index - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('CACHED-DATABASE-RESULT: Invoking %s:%s(indexValue[]=%s) ...', $callback[0], $callback[1], gettype($indexValue))); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('CACHED-DATABASE-RESULT: Invoking %s:%s(indexValue[]=%s) ...', $callback[0], $callback[1], gettype($indexValue))); call_user_func_array($callback, [$indexValue]); // Trace message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('CACHED-DATABASE-RESULT: EXIT!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('CACHED-DATABASE-RESULT: EXIT!'); } } diff --git a/framework/main/classes/feature/class_FrameworkFeature.php b/framework/main/classes/feature/class_FrameworkFeature.php index 2b6293fe..3d2fbeb7 100644 --- a/framework/main/classes/feature/class_FrameworkFeature.php +++ b/framework/main/classes/feature/class_FrameworkFeature.php @@ -82,7 +82,7 @@ class FrameworkFeature extends BaseFrameworkSystem { */ public static function isFeatureEnabled (string $featureName) { // Check parameter - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FRAMEWORK-FEATURE: featureName=%s - CALLED!', $featureName)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('FRAMEWORK-FEATURE: featureName=%s - CALLED!', $featureName)); if (empty($featureName)) { // Throw IAE throw new InvalidArgumentException('Parameter "featureName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); @@ -98,7 +98,7 @@ class FrameworkFeature extends BaseFrameworkSystem { } // Return "cached" status - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FRAMEWORK-FEATURE: is_enabled[%s]=%d - EXIT!', $featureName, intval(self::$enabledFeatures[$featureName]['is_enabled']))); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('FRAMEWORK-FEATURE: is_enabled[%s]=%d - EXIT!', $featureName, intval(self::$enabledFeatures[$featureName]['is_enabled']))); return self::$enabledFeatures[$featureName]['is_enabled']; } @@ -115,7 +115,7 @@ class FrameworkFeature extends BaseFrameworkSystem { */ public static function isFeatureAvailable (string $featureName) { // Check parameter - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FRAMEWORK-FEATURE: featureName=%s - CALLED!', $featureName)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('FRAMEWORK-FEATURE: featureName=%s - CALLED!', $featureName)); if (empty($featureName)) { // Throw IAE throw new InvalidArgumentException('Parameter "featureName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); @@ -130,7 +130,7 @@ class FrameworkFeature extends BaseFrameworkSystem { // Is the feature enabled? if (!self::isFeatureEnabled($featureName)) { // Then it can't be available - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FRAMEWORK-FEATURE: Feature "%s"is not enabled.', $featureName)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('FRAMEWORK-FEATURE: Feature "%s"is not enabled. - EXIT!', $featureName)); return false; } @@ -138,7 +138,7 @@ class FrameworkFeature extends BaseFrameworkSystem { $configKey = sprintf('feature_%s_class', $featureName); // Now try to get the instance - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FRAMEWORK-FEATURE: configKey=%s', $configKey)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('FRAMEWORK-FEATURE: configKey=%s', $configKey)); try { // Try to get an instance self::$enabledFeatures[$featureName]['instance'] = ObjectFactory::createObjectByConfiguredName($configKey); @@ -147,12 +147,12 @@ class FrameworkFeature extends BaseFrameworkSystem { self::$enabledFeatures[$featureName]['is_available'] = self::$enabledFeatures[$featureName]['instance']->isFeatureAvailable(); } catch (NoClassException $e) { // Feature class not found - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FRAMEWORK-FEATURE: Feature "%s"is not available due to missing feature class. Disabling feature ...', $featureName)); + self::createDebugInstance(__CLASS__, __LINE__)->warningMessage(sprintf('FRAMEWORK-FEATURE: Feature "%s"is not available due to missing feature class. Disabling feature ...', $featureName)); } } // Return "cached" status - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FRAMEWORK-FEATURE: featureName=%s,isAvailable=%d - EXIT!', $featureName, intval(self::$enabledFeatures[$featureName]['is_available']))); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('FRAMEWORK-FEATURE: featureName=%s,isAvailable=%d - EXIT!', $featureName, intval(self::$enabledFeatures[$featureName]['is_available']))); return self::$enabledFeatures[$featureName]['is_available']; } @@ -171,7 +171,7 @@ class FrameworkFeature extends BaseFrameworkSystem { */ public static function callFeature (string $featureName, string $featureMethod, array $args = NULL) { // Check parameter - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FRAMEWORK-FEATURE: featureName=%s,featureMethod=%s,args[]=%s - CALLED!', $featureName, $featureMethod, gettype($args))); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('FRAMEWORK-FEATURE: featureName=%s,featureMethod=%s,args[]=%s - CALLED!', $featureName, $featureMethod, gettype($args))); if (empty($featureName)) { // Throw IAE throw new InvalidArgumentException('Parameter "featureName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); @@ -199,7 +199,7 @@ class FrameworkFeature extends BaseFrameworkSystem { $return = call_user_func_array($callable, $args); // Return any returned value - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FRAMEWORK-FEATURE: return[]=%s - EXIT!', gettype($return))); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('FRAMEWORK-FEATURE: return[]=%s - EXIT!', gettype($return))); return $return; } diff --git a/framework/main/classes/file_directories/class_BaseFileIo.php b/framework/main/classes/file_directories/class_BaseFileIo.php index ae783af6..c934ecb5 100644 --- a/framework/main/classes/file_directories/class_BaseFileIo.php +++ b/framework/main/classes/file_directories/class_BaseFileIo.php @@ -49,7 +49,11 @@ abstract class BaseFileIo extends BaseFrameworkSystem implements FilePointer, Cl */ protected function __construct (string $className) { // Call parent constructor + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-FILE-IO: className=%s - CONSTRUCTED!', $className)); parent::__construct($className); + + // Trace message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('BASE-FILE-IO: EXIT!'); } /** @@ -59,10 +63,10 @@ abstract class BaseFileIo extends BaseFrameworkSystem implements FilePointer, Cl */ public final function __destruct() { // Is there a resource pointer? Then we have to close the file here! - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-IO: this->fileObject[]=%s - DESTRUCTOR!', gettype($this->getFileObject()))); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-FILE-IO: this->fileObject[]=%s - DESTRUCTOR!', gettype($this->getFileObject()))); if (is_object($this->getFileObject())) { // Try to close a file - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-FILE-IO: Invoking this->closeFile() ...'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('BASE-FILE-IO: Invoking this->closeFile() ...'); $this->closeFile(); } @@ -70,7 +74,7 @@ abstract class BaseFileIo extends BaseFrameworkSystem implements FilePointer, Cl parent::__destruct(); // Trace message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-FILE-IO: EXIT!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('BASE-FILE-IO: EXIT!'); } /** @@ -83,7 +87,7 @@ abstract class BaseFileIo extends BaseFrameworkSystem implements FilePointer, Cl */ public function closeFile () { // Validate parameter - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-IO: fileName=%s - CALLED!', $this->getFileObject()->getPathname())); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-FILE-IO: fileName=%s - CALLED!', $this->getFileObject()->getPathname())); if (is_null($this->getFileObject())) { // Pointer not initialized throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER); @@ -93,11 +97,11 @@ abstract class BaseFileIo extends BaseFrameworkSystem implements FilePointer, Cl } // Close the file pointer by NULL-ing it - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-IO: Closing file %s ...', $this->getFileObject()->getPathname())); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('BASE-FILE-IO: Closing file %s ...', $this->getFileObject()->getPathname())); $this->resetFileObject(); // Trace message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-FILE-IO: EXIT!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('BASE-FILE-IO: EXIT!'); } /** @@ -107,7 +111,11 @@ abstract class BaseFileIo extends BaseFrameworkSystem implements FilePointer, Cl */ protected final function resetFileObject () { // Set it to NULL + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('BASE-FILE-IO: Setting this->fileObject=NULL - CALLED!'); $this->fileObject = NULL; + + // Trace message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('BASE-FILE-IO: EXIT!'); } /** @@ -156,7 +164,7 @@ abstract class BaseFileIo extends BaseFrameworkSystem implements FilePointer, Cl */ public function seek (int $offset, int $whence = SEEK_SET) { // Validate parameter - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-IO: offset=%d,whence=%d - CALLED!', $offset, $whence)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-FILE-IO: offset=%d,whence=%d - CALLED!', $offset, $whence)); if ($offset < 0) { // Throw exception throw new OutOfBoundsException(sprintf('offset=%d is not valid', $offset)); @@ -166,7 +174,7 @@ abstract class BaseFileIo extends BaseFrameworkSystem implements FilePointer, Cl $status = $this->getFileObject()->fseek($offset, $whence); // Return status - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-IO: status=%d - EXIT!', $status)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-FILE-IO: status=%d - EXIT!', $status)); return $status; } @@ -178,22 +186,22 @@ abstract class BaseFileIo extends BaseFrameworkSystem implements FilePointer, Cl */ public function size () { // Get current seek position - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-FILE-IO: CALLED!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('BASE-FILE-IO: CALLED!'); $seekPosition = $this->determineSeekPosition(); // Seek to end $seekStatus = $this->seek(0, SEEK_END); // Get position again (which is the end of the file) - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-IO: seekStatus[%s]=%d', gettype($seekStatus), $seekStatus)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('BASE-FILE-IO: seekStatus[%s]=%d', gettype($seekStatus), $seekStatus)); $size = $this->determineSeekPosition(); // Reset seek position to old - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-IO: size[%s]=%d', gettype($size), $size)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('BASE-FILE-IO: size[%s]=%d', gettype($size), $size)); $this->seek($seekPosition); // Return size - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-IO: size=%d - EXIT!', $size)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-FILE-IO: size=%d - EXIT!', $size)); return $size; } diff --git a/framework/main/classes/file_directories/text/output/class_BaseOutputTextFile.php b/framework/main/classes/file_directories/text/output/class_BaseOutputTextFile.php index cf5af1c5..ba85de96 100644 --- a/framework/main/classes/file_directories/text/output/class_BaseOutputTextFile.php +++ b/framework/main/classes/file_directories/text/output/class_BaseOutputTextFile.php @@ -5,6 +5,7 @@ namespace Org\Mxchange\CoreFramework\Filesystem\Text; // Import framework stuff use Org\Mxchange\CoreFramework\Factory\Object\ObjectFactory; use Org\Mxchange\CoreFramework\Filesystem\File\BaseAbstractFile; +use Org\Mxchange\CoreFramework\Generic\FrameworkInterface; use Org\Mxchange\CoreFramework\Output\BaseOutput; /** @@ -46,13 +47,25 @@ abstract class BaseOutputTextFile extends BaseAbstractFile { * * @param $fileName File's name * @return void + * @throws InvalidArgumentException If a parameter has an invalid value */ - protected function initFile ($fileName) { + protected function initFile (string $fileName) { + // Check parameter + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-OUTPUT-TEXT-FILE: fileName=%s - CALLED!', $fileName)); + if (empty($fileName)) { + // Throw IAE + throw new InvalidArgumentException('Parameter "fileName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); + } + // Get a file i/o pointer instance - $pointerInstance = ObjectFactory::createObjectByConfiguredName('text_file_output_class', array($fileName)); + $pointerInstance = ObjectFactory::createObjectByConfiguredName('text_file_output_class', [$fileName]); // ... and set it here + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('BASE-OUTPUT-TEXT-FILE: Setting pointerInstance=%s ...', $pointerInstance->__toString())); $this->setPointerInstance($pointerInstance); + + // Trace message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('BASE-OUTPUT-TEXT-FILE: EXIT!'); } } diff --git a/framework/main/classes/utils/arrays/class_ArrayUtils.php b/framework/main/classes/utils/arrays/class_ArrayUtils.php index 48b0c581..884a29f3 100644 --- a/framework/main/classes/utils/arrays/class_ArrayUtils.php +++ b/framework/main/classes/utils/arrays/class_ArrayUtils.php @@ -76,7 +76,7 @@ final class ArrayUtils extends BaseFrameworkSystem { //* NOISY-DEBUG */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('ARRAY-UTILS: sourceIndex=%d,targetName=%s', $sourceIndex, $targetName)); if (!array_key_exists($sourceIndex, $numericArray)) { // Should always be there! - throw new OutOfBoundsException(sprintf('numericArray[%d] does not exist.', $sourceIndex)); + throw new OutOfBoundsException(sprintf('numericArray[%d] does not exist.', $sourceIndex), FrameworkInterface::EXCEPTION_OUT_OF_BOUNDS); } // "Map" (copy) it to new array diff --git a/framework/main/interfaces/class_FrameworkInterface.php b/framework/main/interfaces/class_FrameworkInterface.php index 80b84b75..836bba5e 100644 --- a/framework/main/interfaces/class_FrameworkInterface.php +++ b/framework/main/interfaces/class_FrameworkInterface.php @@ -34,6 +34,7 @@ interface FrameworkInterface { const EXCEPTION_UNEXPECTED_VALUE = 0x203; const EXCEPTION_CLASS_NOT_FOUND = 0x204; const EXCEPTION_BAD_METHOD_CALL = 0x205; + const EXCEPTION_OUT_OF_BOUNDS = 0x206; /** * Getter for field name diff --git a/framework/main/interfaces/database/middleware/class_DatabaseConnector.php b/framework/main/interfaces/database/middleware/class_DatabaseConnector.php index 869c1c1e..ee45bb0a 100644 --- a/framework/main/interfaces/database/middleware/class_DatabaseConnector.php +++ b/framework/main/interfaces/database/middleware/class_DatabaseConnector.php @@ -5,7 +5,6 @@ namespace Org\Mxchange\CoreFramework\Connector\Database; // Import framework stuff use Org\Mxchange\CoreFramework\Criteria\Criteria; use Org\Mxchange\CoreFramework\Criteria\Storing\StoreableCriteria; -use Org\Mxchange\CoreFramework\Database\Backend\DatabaseBackend; use Org\Mxchange\CoreFramework\Database\FrameworkDatabase; /** @@ -56,13 +55,6 @@ interface DatabaseConnector extends FrameworkDatabase { */ function getConnectionData (); - /** - * Setter for the real database layer - * @param $dbLayer An instance of the real database layer - * @return void - */ - function setDatabaseLayer (DatabaseBackend $dbLayer); - /** * Getter for index key * diff --git a/framework/main/middleware/database/class_DatabaseConnection.php b/framework/main/middleware/database/class_DatabaseConnection.php index 38be6e7d..5dadd46e 100644 --- a/framework/main/middleware/database/class_DatabaseConnection.php +++ b/framework/main/middleware/database/class_DatabaseConnection.php @@ -8,12 +8,14 @@ use Org\Mxchange\CoreFramework\Criteria\Criteria; use Org\Mxchange\CoreFramework\Criteria\Storing\StoreableCriteria; use Org\Mxchange\CoreFramework\Database\Backend\DatabaseBackend; use Org\Mxchange\CoreFramework\Generic\FrameworkInterface; -use Org\Mxchange\CoreFramework\Registry\Registerable; use Org\Mxchange\CoreFramework\Middleware\BaseMiddleware; -use Org\Mxchange\CoreFramework\Middleware\Debug\DebugMiddleware; +use Org\Mxchange\CoreFramework\Registry\Registerable; +use Org\Mxchange\CoreFramework\Result\Database\BaseDatabaseResult; // Import SPL stuff use \InvalidArgumentException; +use \OutOfBoundsException; +use \UnexpectedValueException; /** * Database selector class @@ -41,12 +43,12 @@ class DatabaseConnection extends BaseMiddleware implements DatabaseConnector, Re /** * Array for connection data */ - private $connectData = array( + private $connectData = [ 'login' => '', 'pass' => '', 'dbase' => '', - 'host' => '' - ); + 'host' => '', + ]; /** * The real database layer @@ -69,21 +71,22 @@ class DatabaseConnection extends BaseMiddleware implements DatabaseConnector, Re /** * Creates a new database connection layer * - * @param $debugInstance An instance of a DebugMiddleware class * @param $backendInstance An instance of a DatabaseBackend class * @todo $debugInstance is currently not used */ - public static final function createDatabaseConnection (DebugMiddleware $debugInstance, DatabaseBackend $backendInstance) { + public static final function createDatabaseConnection (DatabaseBackend $backendInstance) { // Get instance + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('DATABASE-CONNECTION: backendInstance=%s - CALLED!', $backendInstance->__toString())); $databaseInstance = new DatabaseConnection(); // Set database layer - $databaseInstance->setDatabaseLayer($backendInstance); + $databaseInstance->setBackendInstance($backendInstance); // Set db instance self::$selfInstance = $databaseInstance; // Return instance + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('DATABASE-CONNECTION: databaseInstance=%s - EXIT!', $databaseInstance->__toString())); return $databaseInstance; } @@ -96,6 +99,15 @@ class DatabaseConnection extends BaseMiddleware implements DatabaseConnector, Re return self::$selfInstance; } + /** + * Setter for the real database layer + * @param $backendInstance An instance of a DatabaseBackend class + * @return void + */ + private final function setBackendInstance (DatabaseBackend $backendInstance) { + $this->backendInstance = $backendInstance; + } + /** * Setter for all database connection data. All these parameters may be * supported by the underlaying backend. @@ -105,13 +117,31 @@ class DatabaseConnection extends BaseMiddleware implements DatabaseConnector, Re * @param $dbase Name of used database * @param $host Host to connect to (default: 127.0.0.1) * @return void + * @throws InvalidArgumentException If a parameter is empty */ - public final function setConnectionData (string $login, string $pass, string $dbase, string $host = '127.0.0.1') { + public final function setConnectionData (string $login, string $pass, string $dbase, string $host = 'localhost') { + // Check parameter + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('DATABASE-CONNECTION: login=%s,pass=%s,dbase=%s,host=%s CALLED!', $login, $pass, $dbase, $host)); + if (empty($login)) { + // Throw IAE + throw new InvalidArgumentException('Parameter "login" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); + } elseif (empty($dbase)) { + // Throw IAE + throw new InvalidArgumentException('Parameter "dbase" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); + } elseif (empty($host)) { + // Throw IAE + throw new InvalidArgumentException('Parameter "host" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); + } + // Transfer connection data + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage('DATABASE-CONNECTION: Setting data ...'); $this->connectData['login'] = $login; $this->connectData['pass'] = $pass; $this->connectData['dbase'] = $dbase; $this->connectData['host'] = $host; + + // Trace message + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('DATABASE-CONNECTION: EXIT!'); } /** @@ -123,15 +153,6 @@ class DatabaseConnection extends BaseMiddleware implements DatabaseConnector, Re return $this->connectData; } - /** - * Setter for the real database layer - * @param $backendInstance An instance of a DatabaseBackend class - * @return void - */ - public final function setDatabaseLayer (DatabaseBackend $backendInstance) { - $this->backendInstance = $backendInstance; - } - /** * Getter for index key * @@ -149,21 +170,42 @@ class DatabaseConnection extends BaseMiddleware implements DatabaseConnector, Re * @param $criteriaInstance An instance of a Criteria class * @return $result The result as an array * @throws InvalidArgumentException If a parameter is empty + * @throws OutOfBoundsException If important array elements are not present + * @throws UnexpectedValueException If $result['status'] is not 'ok' */ public function doSelectByTableCriteria (string $tableName, Criteria $criteriaInstance) { // Validate parameter + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('DATABASE-CONNECTION: tableName=%s,criteriaInstance=%s - CALLED!', $tableName, $criteriaInstance->__toString())); if (empty($tableName)) { // Throw IAE throw new InvalidArgumentException('Parameter "tableName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } // Connect to the database + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('DATABASE-CONNECTION: Invoking this->backendInstance->connectToDatabase() ...'); $this->backendInstance->connectToDatabase(); // Get result from query + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('DATABASE-CONNECTION: Invoking this->backendInstance->querySelect(%s,%s) ...', $tableName, $criteriaInstance->__toString())); $result = $this->backendInstance->querySelect($tableName, $criteriaInstance); + // Is a valid array returned? + if (!isset($result[BaseDatabaseResult::RESULT_NAME_STATUS])) { + // Missing element + throw new OutOfBoundsException(sprintf('result()=%d does not have element "%s"', count($result), BaseDatabaseResult::RESULT_NAME_STATUS), FrameworkInterface::EXCEPTION_OUT_OF_BOUNDS); + } elseif ($result[BaseDatabaseResult::RESULT_NAME_STATUS] != 'ok') { + // Is exception given? + if (isset($result[BaseDatabaseResult::RESULT_NAME_EXCEPTION])) { + // Attach it + throw new UnexpectedValueException(sprintf('result[%s]=%s is not "ok" with cause', BaseDatabaseResult::RESULT_NAME_STATUS), FrameworkInterface::EXCEPTION_INVALID_ARGUMENT, BaseDatabaseResult::RESULT_NAME_EXCEPTION); + } else { + // No exception attached + throw new UnexpectedValueException(sprintf('result[%s]=%s is not "ok"', BaseDatabaseResult::RESULT_NAME_STATUS, $result[BaseDatabaseResult::RESULT_NAME_STATUS]), FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); + } + } + // Return the result + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('DATABASE-CONNECTION: result[]=%s - EXIT!', gettype($result))); return $result; } @@ -173,7 +215,12 @@ class DatabaseConnection extends BaseMiddleware implements DatabaseConnector, Re * @return $exceptionInstance Last thrown exception */ public final function getLastException () { + // Get instance + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('DATABASE-CONNECTION: CALLED!'); $exceptionInstance = $this->backendInstance->getLastException(); + + // Return it + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('DATABASE-CONNECTION: exceptionInstance=%s - EXIT!', $exceptionInstance->__toString())); return $exceptionInstance; } @@ -185,10 +232,15 @@ class DatabaseConnection extends BaseMiddleware implements DatabaseConnector, Re */ public function queryInsertDataSet (StoreableCriteria $dataSetInstance) { // Connect to the database + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('DATABASE-CONNECTION: dataSetInstance=%s - CALLED!', $dataSetInstance->__toString())); $this->backendInstance->connectToDatabase(); // Ask the database layer + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('DATABASE-CONNECTION: Invoking this->backendInstance->queryInsertDataSet(%s) ...', $dataSetInstance->__toString())); $this->backendInstance->queryInsertDataSet($dataSetInstance); + + // Trace message + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('DATABASE-CONNECTION: EXIT!'); } /** @@ -199,10 +251,15 @@ class DatabaseConnection extends BaseMiddleware implements DatabaseConnector, Re */ public function queryUpdateDataSet (StoreableCriteria $dataSetInstance) { // Connect to the database + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('DATABASE-CONNECTION: dataSetInstance=%s - CALLED!', $dataSetInstance->__toString())); $this->backendInstance->connectToDatabase(); // Ask the database layer + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('DATABASE-CONNECTION: Invoking this->backendInstance->queryUpdateDataSet(%s) ...', $dataSetInstance->__toString())); $this->backendInstance->queryUpdateDataSet($dataSetInstance); + + // Trace message + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('DATABASE-CONNECTION: EXIT!'); } /** @@ -214,18 +271,22 @@ class DatabaseConnection extends BaseMiddleware implements DatabaseConnector, Re */ public function getPrimaryKeyOfTable (string $tableName) { // Validate parameter + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('DATABASE-CONNECTION: tableName=%s - CALLED!', $tableName)); if (empty($tableName)) { // Throw IAE throw new InvalidArgumentException('Parameter "tableName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } // Connect to the database + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('DATABASE-CONNECTION: Invoking this->backendInstance->connectToDatabase() ...'); $this->backendInstance->connectToDatabase(); // Ask the database layer + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('DATABASE-CONNECTION: Invoking this->backendInstance->getPrimaryKeyOfTable(%s) ...', $tableName)); $primaryKey = $this->backendInstance->getPrimaryKeyOfTable($tableName); // Return the value + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('DATABASE-CONNECTION: primaryKey=%s - CALLED!', $primaryKey)); return $primaryKey; } @@ -234,18 +295,26 @@ class DatabaseConnection extends BaseMiddleware implements DatabaseConnector, Re * * @param $data An array with possible non-public data that needs to be removed. * @return $data A cleaned up array with only public data. + * @throws InvalidArgumentException If a parameter has an invalid value */ public function removeNonPublicDataFromArray (array $data) { + // Check parameter + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('DATABASE-CONNECTION: data()=%d - CALLED!', count($data))); + if (count($data) == 0) { + // Throw IAE + throw new InvalidArgumentException('Parameter "data" is an empty array', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); + } + // Connect to the database - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('DB-CONNECTION: data()=%d - CALLED!', count($data))); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('DATABASE-CONNECTION: Invoking this->backendInstance->connectToDatabase() ...'); $this->backendInstance->connectToDatabase(); // Call database backend - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('DB-CONNECTION: Invoking this->backendInstance->removeNonPublicDataFromArray(data()=%d) ...', count($data))); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('DATABASE-CONNECTION: Invoking this->backendInstance->removeNonPublicDataFromArray(data()=%d) ...', count($data))); $data = $this->backendInstance->removeNonPublicDataFromArray($data); // Trace message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('DB-CONNECTION: data()=%d - EXIT!', count($data))); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('DATABASE-CONNECTION: data()=%d - EXIT!', count($data))); return $data; } @@ -258,20 +327,21 @@ class DatabaseConnection extends BaseMiddleware implements DatabaseConnector, Re */ public function countTotalRows (string $tableName) { // Validate parameter - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('DB-CONNECTION: tableName=%s - CALLED!', $tableName)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('DATABASE-CONNECTION: tableName=%s - CALLED!', $tableName)); if (empty($tableName)) { // Throw IAE throw new InvalidArgumentException('Parameter "tableName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } // Connect to the database + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('DATABASE-CONNECTION: Invoking this->backendInstance->connectToDatabase() ...'); $this->backendInstance->connectToDatabase(); // Ask the database layer $count = $this->backendInstance->countTotalRows($tableName); // Return the value - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('DB-CONNECTION: count=%d - CALLED!', $count)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('DATABASE-CONNECTION: count=%d - CALLED!', $count)); return $count; } diff --git a/framework/main/middleware/io/class_FileIoHandler.php b/framework/main/middleware/io/class_FileIoHandler.php index 7658aa0d..f6c649d0 100644 --- a/framework/main/middleware/io/class_FileIoHandler.php +++ b/framework/main/middleware/io/class_FileIoHandler.php @@ -206,10 +206,8 @@ class FileIoHandler extends BaseMiddleware implements IoHandler { * @todo 0% done */ public function size () { - // Trace message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('FILE-IO-HANDLER: CALLED!'); - // @TODO: Unfinished method: + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('FILE-IO-HANDLER: CALLED!'); DebugMiddleware::getSelfInstance()->partialStub(); // Trace message @@ -223,10 +221,8 @@ class FileIoHandler extends BaseMiddleware implements IoHandler { * @todo 0% done */ public function getPosition () { - // Trace message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('FILE-IO-HANDLER: CALLED!'); - // @TODO: Unfinished method: + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('FILE-IO-HANDLER: CALLED!'); DebugMiddleware::getSelfInstance()->partialStub(); // Trace message -- 2.39.5