/**
  * Saves the data to the database
  *
  * @return void
  */
 public function insertIntoDB()
 {
     //lookup SDE class
     $sdeClass = \iveeCore\Config::getIveeClassName('SDE');
     $sde = $sdeClass::instance();
     $sql = '';
     $count = 0;
     foreach ($this->data->items as $item) {
         $sql .= $this->processDataItemToSQL($item);
         $count++;
         if ($count % 100 == 0 or $count == $this->data->totalCount) {
             $sde->multiQuery($sql . ' COMMIT;');
             $sql = '';
         }
     }
     if (\iveeCore\Config::getUseCache()) {
         $this->invalidateCaches();
     }
     $this->updatedIDs = array();
 }
Esempio n. 2
0
 /**
  * Updates or invalidates cache entries after market data update
  * 
  * @param int $typeID the ID of the item
  * @param int $regionID the ID of the region
  * @param \ArrayObject $timestamps with two elements carrying the UNIX timestamps
  * 
  * @return void
  */
 protected function updateCaches($typeID, $regionID, \ArrayObject $timestamps)
 {
     if (\iveeCore\Config::getUseCache()) {
         //update timestamps cache
         $this->cache->setItem($timestamps, 'emdrts_' . $regionID . '_' . $typeID);
         //invalidate the type cache for the item that was updated if its the default region
         if ($regionID == $this->defaultRegionID) {
             $this->cache->deleteItem('Type_' . $typeID);
         }
     }
 }