// Constants for database table names
const DB_TABLE_CITY_SECTIONS = 'city_sections';
+ // Entry id
+ const DB_COLUMN_ENTRY_ID = 'entry_id';
+
// Section id, an referenced city id and lot id
const DB_COLUMN_SECTION_ID = 'city_section_id';
const DB_COLUMN_CITY_ID = 'city_id';
$maxUp = $this->getConfigInstance()->getConfigEntry('city_max_initial_up_expansion');
$maxDown = $this->getConfigInstance()->getConfigEntry('city_max_initial_down_expansion');
- // Extremely huge debug message:
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: radius=' . $radius . ',maxUp=' . $maxUp . ',maxDown=' . $maxDown);
+ // Calculate total sections
+ $totalSections = (($radius + 1) * ($radius + 1) * $maxUp * ($maxDown + 1));
+
+ // Debug message:
+ /* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: radius=' . $radius . ',maxUp=' . $maxUp . ',maxDown=' . $maxDown . ',totalSections=' . $totalSections);
// Get data set instance
$dataSetInstance = ObjectFactory::createObjectByConfiguredName('dataset_criteria_class', array(self::DB_TABLE_CITY_SECTIONS));
// Set primary key to 'city_id'/'section_id'
$dataSetInstance->setPrimaryKeyCombined(array(self::DB_COLUMN_CITY_ID, self::DB_COLUMN_SECTION_ID));
+ // Entry id for counting each entry
+ $dataSetInstance->setUniqueKey(self::DB_COLUMN_ENTRY_ID);
+
// Add "zero point"
$this->queryInsertDataSet($dataSetInstance);
$sections = array();
// Output message to ask for user's patience ...
- self::createDebugInstance(__CLASS__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: Writing ' . (($radius + 1) * ($radius + 1) * $maxUp * ($maxDown + 1)) . ' sections for city ' . $cityId . ' ... (this may takes some time)');
+ self::createDebugInstance(__CLASS__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: Writing ' . $totalSections . ' sections for city ' . $cityId . ' ... (this may takes some time)');
// Expand half of it to north/south (north=positive, south=negative)
for ($north = 1; $north < round($radius / 2); $north++) {
} // END - foreach
// Thank you for waiting! :-)
- self::createDebugInstance(__CLASS__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: ' . (($radius + 1) * ($radius + 1) * $maxUp * ($maxDown + 1)) . ' sections has been written for city ' . $cityId . '.');
+ self::createDebugInstance(__CLASS__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: A total of ' . $totalSections . ' sections has been written for city id ' . $cityId . '.');
}
}