// Convert dashes to underscore
$criteriaKey = $this->convertDashesToUnderscores($criteriaKey);
+ // Debug message
+ //* NOISY-DEBUG: */ $this->debugOutput('CRITERIA: criteriaKey=' . $criteriaKey . ',criteria()=' . count($this->criteria));
+
// Default is not found
$value = NULL;
if (isset($this->criteria[$criteriaKey])) {
// Then use it
$value = $this->criteria[$criteriaKey];
- }
+ } // END - if
// Return the value
return $value;
// Return the cache key
return $cacheKey;
}
+
+ /**
+ * Count the criteria, e.g. useful to find out if a database query has no limitation (search criteria)
+ *
+ * @return $count Count of all criteria entries
+ */
+ public final function count () {
+ // Return it
+ return count($this->criteria);
+ }
}
// [EOF]
* @return $dataArray
*/
private function getDataArrayFromFile ($fqfn) {
+ // Debug message
+ //* NOISY-DEBUG: */ $this->debugOutput('DATABASE: Reading elements from database file ' . $fqfn . ' ...');
+
// Get a file pointer
$fileInstance = FrameworkFileInputPointer::createFrameworkFileInputPointer($fqfn);
// Unserialize it
$dataArray = unserialize($serializedData);
+ // Debug message
+ //* NOISY-DEBUG: */ $this->debugOutput('DATABASE: Read ' . count($dataArray) . ' elements from database file ' . $fqfn . '.');
+
// Finally return it
return $dataArray;
}
*/
private function writeDataArrayToFqfn ($fqfn, array $dataArray) {
// Debug message
- /* NOISY-DEBUG: */ $this->debugOutput('DATABASE: Flushing ' . count($dataArray) . ' elements to database file ' . $fqfn . ' ...');
+ //* NOISY-DEBUG: */ $this->debugOutput('DATABASE: Flushing ' . count($dataArray) . ' elements to database file ' . $fqfn . ' ...');
// Get a file pointer instance
$fileInstance = FrameworkFileOutputPointer::createFrameworkFileOutputPointer($fqfn, 'w');
$fileInstance->closeFile();
// Debug message
- /* NOISY-DEBUG: */ $this->debugOutput('DATABASE: Flushing ' . count($dataArray) . ' elements to database file completed.');
+ //* NOISY-DEBUG: */ $this->debugOutput('DATABASE: Flushing ' . count($dataArray) . ' elements to database file completed.');
}
/**
// Get criteria element
$criteria = $criteriaInstance->getCriteriaElemnent($key);
- // Is the criteria met?
- //* NOISY-DEBUG: */ $this->debugOutput('DATABASE: criteria[' . gettype($criteria) . ']=' . $criteria . ',()=' . strlen($criteria) . ',value=' . $value . ',()=' . strlen($value));
- if ((!is_null($criteria)) && ($criteria == $value)) {
+ // Is the criteria met or none set?
+ //* NOISY-DEBUG: */ $this->debugOutput('DATABASE: criteria[' . gettype($criteria) . ']=' . $criteria . ';()=' . strlen($criteria) . ',criteriaInstance()=' . $criteriaInstance->count() . ',value(' . strlen($value) . ')=' . $value);
+ if (((!is_null($criteria)) && ($criteria == $value)) || ($criteriaInstance->count() == 0)) {
// Shall we skip this entry?
if ($criteriaInstance->getSkip() > 0) {
// We shall skip some entries
while (($dataFile = $directoryInstance->readDirectoryExcept(array('.', '..', '.htaccess', '.svn', 'info.' . $this->getFileExtension()))) && ($limitFound < $searchInstance->getLimit())) {
// Does the extension match?
if (substr($dataFile, -(strlen($this->getFileExtension()))) !== $this->getFileExtension()) {
+ // Debug message
+ /* NOISY-DEBUG: */ $this->debugOutput('DATABASE: dataFile=' . $dataFile . ',getFileExtension()=' . $this->getFileExtension());
// Skip this file!
continue;
} // END - if