Changeset 64 for trunk/fill_database.php
- Timestamp:
- Feb 5, 2009, 10:39:11 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/fill_database.php
r56 r64 2 2 3 3 include('includes/global.php'); 4 include('dbc/dbc.php'); 4 5 5 6 echo('Načítání textů z databáze MaNGOSu: '); … … 55 56 } 56 57 echo('<br />Celkem: '.$Count.' Nových: '.$NewCount.'<br />'); 57 } 58 } else 59 if(($Group['DBCFileName'] != '') and ($Group['TablePrefix'] != '')) 60 { 61 echo('<br />'.$Group['Name'].'<br />'); 62 $DBCFile = new DBCReader(); 63 $DBCFile->loadDbc('dbc/'.$Group['DBCFileName'].'.dbc', $Group['DBCColumns']); 64 $ItemCount = $DBCFile->count(); 65 $NewCount = 0; 66 $Count = 0; 67 for($i = 0; $i < $ItemCount; $i++) 68 { 69 $ItemId = $DBCFile->getUint($i, 0); 70 $DbResult2 = $Database->SQLCommand('SELECT ID FROM '.$Group['TablePrefix'].' WHERE entry='.$ItemId.' AND Language=0'); 71 if(isset($DbResult2) and (mysql_num_rows($DbResult2) > 0)) 72 { 73 $DbRow2 = mysql_fetch_assoc($DbResult2); 74 //echo($DbRow2['ID']); 75 $ColumnsValues = ''; 76 foreach($Group['Items'] as $GroupItem) 77 { 78 $ColumnsValues .= ', `'.$GroupItem['Column'].'`="'.addslashes($DBCFile->getString($i, $GroupItem['DBCColumnIndex'])).'"'; 79 } 80 $ColumnsValues = substr($ColumnsValues, 2); 81 echo('. '); //'UPDATE `'.$Group['TablePrefix'].'` SET '.$ColumnsValues.' WHERE ID='.$DbRow2['ID']."<br>"); 82 //print_r($DbRow2); 83 $Database->SQLCommand('UPDATE `'.$Group['TablePrefix'].'` SET '.$ColumnsValues.' WHERE ID='.$DbRow2['ID']); 84 } else 85 { 86 $Columns = 'entry, language'; 87 $Values = $ItemId.', 0'; 88 foreach($Group['Items'] as $GroupItem) 89 { 90 $Columns .= ', `'.$GroupItem['Column'].'`'; 91 $Values .= ', "'.addslashes($DBCFile->getString($i, $GroupItem['DBCColumnIndex'])).'"'; 92 } 93 //$Columns = substr($Columns, 2); 94 //$Values = substr($Values, 2); 95 $Database->SQLCommand('INSERT `'.$Group['TablePrefix'].'` ('.$Columns.') VALUES ('.$Values.')'); 96 echo('# '); 97 //echo('INSERT `'.$Group['TablePrefix'].'` ('.$Columns.') VALUES ('.$Values.')'."<br>"); 98 $NewCount++; 99 } 100 $Count++; 101 } 102 echo('<br />Celkem: '.$Count.' Nových: '.$NewCount.'<br />'); 103 } 58 104 } 59 105 echo('Dokončeno.</div>');
Note:
See TracChangeset
for help on using the changeset viewer.