Ignore:
Timestamp:
Mar 9, 2010, 1:01:14 PM (15 years ago)
Author:
george
Message:
  • Upraveno: Přejmenovány všechny tabulky textů na názvy s prvními velkými písmeny ve slovech plus pro odlišení s prefixem Text.
  • Upraveno: Další SQL dotazy doplněny o SQL uvozovky.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/import/import_sql_mangos.php

    r357 r366  
    104104        $Columns = substr($Columns, 1);
    105105
    106         if($Group['Id'] == 8)$DbResult2 = $Database->SQLCommand('SELECT VersionEnd, ID, entry, '.$Columns.' FROM '.$Group['TablePrefix'].' WHERE Name="'.$Value['name'].'" AND (Language=0) ORDER BY VersionStart DESC LIMIT 1');
    107         else $DbResult2 = $Database->SQLCommand('SELECT VersionEnd, ID, entry, '.$Columns.' FROM '.$Group['TablePrefix'].' WHERE entry='.$Value[$Group['MangosTableIndex']].' AND (Language=0) ORDER BY VersionStart DESC LIMIT 1');
     106        if($Group['Id'] == 8)$DbResult2 = $Database->SQLCommand('SELECT `VersionEnd`, `ID`, `Entry`, '.$Columns.' FROM `'.$Group['TablePrefix'].'` WHERE `Name`="'.$Value['name'].'" AND (`Language`=0) ORDER BY `VersionStart` DESC LIMIT 1');
     107        else $DbResult2 = $Database->SQLCommand('SELECT `VersionEnd`, `ID`, `Entry`, '.$Columns.' FROM `'.$Group['TablePrefix'].'` WHERE `Entry`='.$Value[$Group['MangosTableIndex']].' AND (`Language`=0) ORDER BY `VersionStart` DESC LIMIT 1');
    108108        if(isset($DbResult2) and (mysql_num_rows($DbResult2) > 0))
    109109        {
     
    114114            if ($DbRow2['VersionEnd'] <> $BuildNumber)
    115115            {
    116               $Database->SQLCommand('UPDATE `'.$Group['TablePrefix'].'` SET VersionEnd = "'.$BuildNumber.'" WHERE ID='.$DbRow2['ID']);
     116              $Database->SQLCommand('UPDATE `'.$Group['TablePrefix'].'` SET `VersionEnd` = "'.$BuildNumber.'" WHERE `ID`='.$DbRow2['ID']);
    117117              echo(', ');
    118118            } else echo('. ');
    119119          } else
    120120          {       
    121             $Columns = 'entry, language, VersionStart, VersionEnd';
    122             $Values = $DbRow2['entry'].', 0, '.$BuildNumber.', '.$BuildNumber;
     121            $Columns = '`Entry`, `Language`, `VersionStart`, `VersionEnd`';
     122            $Values = $DbRow2['Entry'].', 0, '.$BuildNumber.', '.$BuildNumber;
    123123            foreach($Group['Items'] as $GroupItem)
    124124            {
     
    131131              $Database->SQLCommand('INSERT `'.$Group['TablePrefix'].'` ('.$Columns.') VALUES ('.$Values.')');
    132132              echo('# ');
    133               WriteLog('Text <a href="form.php?group='.$Group['Id'].'&amp;ID='.mysql_insert_id().'">'.mysql_insert_id().'</a> ('.$DbRow2['entry'].') ze skupiny '.$Group['Name'].' byl v nové verzi '.$import_version.' změněn.', LOG_TYPE_IMPORT);
     133              WriteLog('Text <a href="form.php?group='.$Group['Id'].'&amp;ID='.mysql_insert_id().'">'.mysql_insert_id().'</a> ('.$DbRow2['Entry'].') ze skupiny '.$Group['Name'].' byl v nové verzi '.$import_version.' změněn.', LOG_TYPE_IMPORT);
    134134            } else echo('. ');       
    135135          }       
     
    141141          {
    142142            $Entry = 1;
    143             $DbResult = $Database->SQLCommand('SELECT MAX(`entry`) FROM `'.$Group['TablePrefix'].'`');
     143            $DbResult = $Database->SQLCommand('SELECT MAX(`Entry`) FROM `'.$Group['TablePrefix'].'`');
    144144            if(mysql_num_rows($DbResult) > 0)
    145145            {
     
    151151          }
    152152
    153           $Columns = 'entry, language, VersionStart, VersionEnd';
     153          $Columns = '`Entry`, `Language`, `VersionStart`, `VersionEnd`';
    154154          $Values = $Entry.', 0, '.$BuildNumber.', '.$BuildNumber;
    155155          foreach($Group['Items'] as $GroupItem)
     
    168168  }
    169169  echo('<br />Celkem: '.$Count.'  Nových: '.$NewCount.'<br />');
    170   $Database->SQLCommand('UPDATE `group` SET LastVersion = "'.$BuildNumber.'", LastImport = NOW() WHERE Id='.$GroupId);
     170  $Database->SQLCommand('UPDATE `Group` SET `LastVersion` = "'.$BuildNumber.'", `LastImport` = NOW() WHERE `Id`='.$GroupId);
    171171}
    172172
Note: See TracChangeset for help on using the changeset viewer.