+
+ /**
+ * Counts total rows of given table
+ *
+ * @param $tableName Table name
+ * @return $count Total rows of given table
+ */
+ public function countTotalRows($tableName) {
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('DATABASE: tableName=' . $tableName . ' - CALLED!');
+
+ // Create full path name
+ $pathName = $this->getConfigInstance()->getConfigEntry('local_db_path') . $tableName . '/';
+
+ // Try all the requests
+ try {
+ // Get a file pointer instance
+ $directoryInstance = ObjectFactory::createObjectByConfiguredName('directory_class', array($pathName));
+
+ // Initialize counter
+ $count = 0;
+
+ // Read the directory with some exceptions
+ while ($dataFile = $directoryInstance->readDirectoryExcept(array('.htaccess', 'info.' . $this->getFileExtension()))) {
+ // Does the extension match?
+ if (substr($dataFile, -(strlen($this->getFileExtension()))) !== $this->getFileExtension()) {
+ // Debug message
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('DATABASE: dataFile=' . $dataFile . ',getFileExtension()=' . $this->getFileExtension() . ' - SKIPPED!');
+ // Skip this file!
+ continue;
+ } // END - if
+
+ // Count this row up
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('DATABASE: dataFile=' . $dataFile . ',getFileExtension()=' . $this->getFileExtension() . ' - COUNTED!');
+ $count++;
+ } // END - while
+ } catch (FrameworkException $e) {
+ // Catch all exceptions and store them in last error
+ $this->setLastException($e);
+
+ // Throw an SQL exception
+ throw new SqlException(array($this, sprintf('Cannot count on table '%s', is the table created?', $dataSetInstance->getTableName()), self::DB_CODE_TABLE_NOT_FOUND), self::EXCEPTION_SQL_QUERY);
+ }
+
+ // Return count
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('DATABASE: tableName=' . $tableName . ',count=' . $count . ' - EXIT!');
+ return $count;
+ }