Exemplo n.º 1
0
 /**
  * If we're going to keep segmented reports, we need to know which archives are
  * for segments. This info is only in the numeric tables, so we must query them.
  */
 private function findSegmentArchives($numericTables)
 {
     if (!is_null($this->segmentArchiveIds)) {
         return;
     }
     foreach ($numericTables as $table) {
         $tableDate = ArchiveTableCreator::getDateFromTableName($table);
         $maxIdArchive = Db::fetchOne("SELECT MAX(idarchive) FROM {$table}");
         $sql = "SELECT idarchive\n\t\t\t\t\t  FROM {$table}\n\t\t\t\t\t WHERE name != 'done'\n\t\t\t\t\t   AND name LIKE 'done_%.%'\n\t\t\t\t\t   AND idarchive >= ?\n\t\t\t\t\t   AND idarchive < ?";
         $this->segmentArchiveIds[$tableDate] = array();
         foreach (Db::segmentedFetchAll($sql, 0, $maxIdArchive, self::$selectSegmentSize) as $row) {
             $this->segmentArchiveIds[$tableDate][] = $row['idarchive'];
         }
     }
 }