Esempio n. 1
0
 public static function getIndexMap()
 {
     $locationTable = Location\LocationTable::getTableName();
     $locationNameTable = Location\Name\LocationTable::getTableName();
     $locationExternalTable = Location\ExternalTable::getTableName();
     return array('IX_B_SALE_LOC_MARGINS' => array('TABLE' => $locationTable, 'COLUMNS' => array('LEFT_MARGIN', 'RIGHT_MARGIN')), 'IX_B_SALE_LOC_MARGINS_REV' => array('TABLE' => $locationTable, 'COLUMNS' => array('RIGHT_MARGIN', 'LEFT_MARGIN')), 'IX_B_SALE_LOC_PARENT' => array('TABLE' => $locationTable, 'COLUMNS' => array('PARENT_ID')), 'IX_B_SALE_LOC_DL' => array('TABLE' => $locationTable, 'COLUMNS' => array('DEPTH_LEVEL')), 'IX_B_SALE_LOC_TYPE' => array('TABLE' => $locationTable, 'COLUMNS' => array('TYPE_ID')), 'IX_B_SALE_LOC_NAME_NAME_U' => array('TABLE' => $locationNameTable, 'COLUMNS' => array('NAME_UPPER')), 'IX_B_SALE_LOC_NAME_LI_LI' => array('TABLE' => $locationNameTable, 'COLUMNS' => array('LOCATION_ID', 'LANGUAGE_ID')), 'IX_B_SALE_LOC_EXT_LID_SID' => array('TABLE' => $locationExternalTable, 'COLUMNS' => array('LOCATION_ID', 'SERVICE_ID')), 'IXS_LOCATION_COUNTRY_ID' => array('TABLE' => $locationTable, 'COLUMNS' => array('COUNTRY_ID')), 'IXS_LOCATION_REGION_ID' => array('TABLE' => $locationTable, 'COLUMNS' => array('REGION_ID')), 'IXS_LOCATION_CITY_ID' => array('TABLE' => $locationTable, 'COLUMNS' => array('CITY_ID')), 'IX_B_SALE_LOCATION_1' => array('TABLE' => $locationTable, 'COLUMNS' => array('COUNTRY_ID'), 'DROP_ONLY' => true), 'IX_B_SALE_LOCATION_2' => array('TABLE' => $locationTable, 'COLUMNS' => array('REGION_ID'), 'DROP_ONLY' => true), 'IX_B_SALE_LOCATION_3' => array('TABLE' => $locationTable, 'COLUMNS' => array('CITY_ID'), 'DROP_ONLY' => true));
 }
Esempio n. 2
0
 protected function stageDeleteAll()
 {
     switch ($this->step) {
         case 0:
             $this->dbConnection->query('truncate table ' . Location\LocationTable::getTableName());
             break;
         case 1:
             $this->dbConnection->query('truncate table ' . Location\Name\LocationTable::getTableName());
             break;
         case 2:
             $this->dbConnection->query('truncate table ' . Location\ExternalTable::getTableName());
             break;
         case 3:
             Location\GroupLocationTable::deleteAll();
             break;
         case 4:
             Location\SiteLocationTable::deleteAll();
             break;
     }
     $this->nextStep();
     if ($this->step >= 4) {
         $this->nextStage();
     }
 }
Esempio n. 3
0
 public static function ClearAllLocationZIP()
 {
     global $DB;
     if (self::isLocationProMigrated()) {
         $DB->Query("DELETE FROM " . Location\ExternalTable::getTableName());
     } else {
         $DB->Query("DELETE FROM b_sale_location_zip");
     }
 }
	public function restoreIndexes($certainIndex = false)
	{
		$locationTable = Location\LocationTable::getTableName();
		$locationNameTable = Location\Name\LocationTable::getTableName();
		$locationExternalTable = Location\ExternalTable::getTableName();

		$map = array(
			'IX_B_SALE_LOC_MARGINS' => array('TABLE' => $locationTable, 'COLUMNS' => array('LEFT_MARGIN', 'RIGHT_MARGIN')),
			'IX_B_SALE_LOC_MARGINS_REV' => array('TABLE' => $locationTable, 'COLUMNS' => array('RIGHT_MARGIN', 'LEFT_MARGIN')),
			'IX_B_SALE_LOC_PARENT' => array('TABLE' => $locationTable, 'COLUMNS' => array('PARENT_ID')),
			'IX_B_SALE_LOC_DL' => array('TABLE' => $locationTable, 'COLUMNS' => array('DEPTH_LEVEL')),
			'IX_B_SALE_LOC_TYPE' => array('TABLE' => $locationTable, 'COLUMNS' => array('TYPE_ID')),
			'IX_B_SALE_LOC_NAME_NAME_U' => array('TABLE' => $locationNameTable, 'COLUMNS' => array('NAME_UPPER')),
			'IX_B_SALE_LOC_NAME_LI_LI' => array('TABLE' => $locationNameTable, 'COLUMNS' => array('LOCATION_ID', 'LANGUAGE_ID')),
			'IX_B_SALE_LOC_EXT_LID_SID' => array('TABLE' => $locationExternalTable, 'COLUMNS' => array('LOCATION_ID', 'SERVICE_ID')),
		);

		foreach($map as $ixName => $ixData)
		{
			if($certainIndex !== false && $certainIndex != $ixName)
				continue;

			if($this->checkIndexExistsByName($ixName, $ixData['TABLE']))
				return false;

			$this->dbConnection->query('CREATE INDEX '.$ixName.' ON '.$ixData['TABLE'].' ('.implode(', ', $ixData['COLUMNS']).')');
		}
	}