/**
  * Delete old row from $Class::model()->tableName()
  * @param $Class
  * @param $Column
  */
 protected function deleteOldRowTable($Class, $Column)
 {
     $this->_logger->log(__METHOD__ . " " . $Class);
     try {
         if (!$Column['del'] or $Column['del'] == self::defDel) {
             return;
         }
         if (self::$LOG) {
             dd::msg_date(dd::sting_min_len(30, $Class::model()->tableName()));
         }
         if (self::$LOG) {
             $stTime = microtime(true);
         }
         //$sql = "SELECT MAX(".$Column['check'].") - INTERVAL ".self::$_delete_period." ".self::$_delete_periodicity." as endDate FROM ".$Class::model()->tableName().";";
         $sql = "SELECT '" . $Column['del'] . "' - INTERVAL " . self::$_delete_period . " " . self::$_delete_periodicity . " as endDate;";
         $query = $Class::getDbConnect(true)->createCommand($sql)->queryRow();
         $endDateForDelete = $query['endDate'] ? $query['endDate'] : self::defDate;
         $cri = new CDbCriteria();
         $cri->condition = $Column['check'] . " <'" . $endDateForDelete . "'";
         if (self::$LOG) {
             $count = $Class::model()->count($cri);
         }
         if (self::$LOG) {
             $miss = 0;
         }
         try {
             $result = $Class::model()->deleteAll($cri);
         } catch (Exception $e) {
             if (isset($Column['where'])) {
                 $cri->condition = $Column['where'];
             }
             $cri->order = $Column['check'] . " ASC";
             $cri->limit = self::$_maxRow;
             try {
                 $result = $Class::model()->deleteAll($cri);
             } catch (Exception $e) {
                 $result = 0;
             }
         }
         if (self::$LOG) {
             $miss = $count - $result;
         }
         if (self::$LOG) {
             dd::msg("( " . dd::sting_min_len(20, $endDateForDelete) . ") ", " Count row: " . dd::sting_min_len(5, $count) . " Deleted: " . dd::sting_min_len(5, $result), " Miss: " . dd::sting_min_len(5, $miss), " Average time: " . dd::time_micro((microtime(true) - $stTime) / ($count ? $count : 1)) . " Full time: " . (microtime(true) - $stTime));
         }
     } catch (Exception $e) {
         $this->_logger->log(__METHOD__ . "ERROR: ", $e->getMessage());
         if (self::$LOG) {
             dd::msg("ERROR: ", $e->getMessage());
         }
     }
 }