Changeset 720


Ignore:
Timestamp:
Jan 5, 2014, 11:39:40 PM (11 years ago)
Author:
maron
Message:
  • Fixed: insert values separate by \n in sql import
Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Modules/Import/Import.php

    r688 r720  
    113113        }   
    114114
     115        if ($insert) {
     116          $insert = false;
     117          foreach($this->Group['Items'] as $GroupItem)
     118          {
     119            if ($Value[$GroupItem['Column']] <> '') $insert = true;
     120          }
     121        }
    115122       
    116123        if (isset($DbRowMiddle['Entry'])) $insert = false;
     
    130137          $this->System->Database->query('INSERT `'.$this->Group['TablePrefix'].'` ('.$Columns.') VALUES ('.$Values.')');
    131138     
    132       echo '
    133       '.$Value['Entry'].' = '.$DbRowBefore['VersionStart'].'.'.$DbRowBefore['VersionEnd'].'< '.$this->Version['BuildNumber'].' <'.$DbRowAfter['VersionStart'].'.'.$DbRowAfter['VersionEnd'].'... '.$DbRowMiddle['VersionStart'].' '.$DbRowMiddle['VersionEnd'].'
    134       ';
     139          echo '
     140          '.$Value['Entry'].' = '.$DbRowBefore['VersionStart'].'.'.$DbRowBefore['VersionEnd'].'< '.$this->Version['BuildNumber'].' <'.$DbRowAfter['VersionStart'].'.'.$DbRowAfter['VersionEnd'].'... '.$DbRowMiddle['VersionStart'].' '.$DbRowMiddle['VersionEnd'].'
     141          ';
    135142     
    136       if (false !== strpos($Values,'[DEPRECATED'))   
    137       echo $Values;
     143          if (false !== strpos($Values,'[DEPRECATED'))   
     144          echo $Values;
    138145     
    139146          echo('# ');
     
    159166      $Columns = '`Entry`, `Language`, `VersionStart`, `VersionEnd`';
    160167      $Values = $Value['Entry'].', 0, '.$this->Version['BuildNumber'].', '.$this->Version['BuildNumber'];
     168      $insert = false;
    161169      foreach($this->Group['Items'] as $GroupItem)
    162170      {
    163171        $Columns .= ', `'.$GroupItem['Column'].'`';
    164172        $Values .= ', "'.$Value[$GroupItem['Column']].'"';
    165       }
    166       $this->System->Database->query('INSERT `'.$this->Group['TablePrefix'].'` ('.$Columns.') VALUES ('.$Values.')');
    167       $InsertId = $this->System->Database->insert_id;
    168       echo('+ ');
    169       $this->NewItemCount++;
    170       $this->System->ModuleManager->Modules['Log']->WriteLog('Text <a href="form.php?group='.$this->Group['Id'].'&amp;ID='.$InsertId.'">'.$InsertId.'</a> ('.$Value['Entry'].') ze skupiny '.$this->Group['Name'].' byl v nové verzi '.$this->Version['Version'].' přidán.', LOG_TYPE_IMPORT);
     173        if ($Value[$GroupItem['Column']] <> '') $insert = true;
     174      }
     175      if ($insert) {
     176        $this->System->Database->query('INSERT `'.$this->Group['TablePrefix'].'` ('.$Columns.') VALUES ('.$Values.')');
     177        $InsertId = $this->System->Database->insert_id;
     178        echo('+ ');
     179        $this->NewItemCount++;
     180        $this->System->ModuleManager->Modules['Log']->WriteLog('Text <a href="form.php?group='.$this->Group['Id'].'&amp;ID='.$InsertId.'">'.$InsertId.'</a> ('.$Value['Entry'].') ze skupiny '.$this->Group['Name'].' byl v nové verzi '.$this->Version['Version'].' přidán.', LOG_TYPE_IMPORT);
     181      }
    171182    }
    172183  }
     
    436447      if((strpos($Line, 'INSERT INTO `'.$this->Group['MangosTable'].'`') !== false) and (isset($structure)))
    437448      {
     449        while ((strpos($Line, ');') === false) or ($File->EOF()))
     450          $Line = $Line.$File->ReadLine();
     451        $Line = str_replace("),\n(", '),(', $Line);
     452       
    438453        $Line = substr($Line, strpos($Line, '(') + 1);
    439454        $Line = substr($Line, 0, strpos($Line, ');'));
    440455        $LineParts = explode('),(', $Line);
     456       
    441457        unset($Line);
    442      
     458       
    443459        foreach($LineParts as $LinePart)
    444460        {
     461         
    445462          unset($Value, $value_buff);
    446463          foreach($structure as $i => $column)
  • trunk/includes/Version.php

    r719 r720  
    66// and system will need database update.
    77
    8 $Revision = 719; // Subversion revision
     8$Revision = 720; // Subversion revision
    99$DatabaseRevision = 716; // Database structure revision
    1010$ReleaseTime = '2014-01-05';
Note: See TracChangeset for help on using the changeset viewer.