Setup/Sqlgen

* fixed setup skipping custom data if it was >stepSize away from the last entry
This commit is contained in:
Sarjuuk
2016-08-15 00:03:46 +02:00
parent 674a2a7814
commit 321c9ba7f4
6 changed files with 59 additions and 39 deletions

View File

@@ -116,19 +116,22 @@ function items(array $ids = [])
spell_group sg ON sg.spell_id = it.spellid_1 AND it.class = 0 AND it.subclass = 2 AND sg.id IN (1, 2)
LEFT JOIN
game_event ge ON ge.holiday = it.HolidayId AND it.HolidayId > 0
{
WHERE
ct.entry IN (?a)
it.entry > ?d
{
AND it.entry IN (?a)
}
LIMIT
?d, ?d';
?d';
$offset = 0;
while ($items = DB::World()->select($baseQuery, $ids ?: DBSIMPLE_SKIP, $offset, SqlGen::$stepSize))
$lastMax = 0;
while ($items = DB::World()->select($baseQuery, $lastMax, $ids ?: DBSIMPLE_SKIP, $offset, SqlGen::$stepSize))
{
CLISetup::log(' * sets '.($offset + 1).' - '.($offset + count($items)));
$newMax = max(array_column($items, 'entry'));
$offset += SqlGen::$stepSize;
CLISetup::log(' * sets '.($lastMax + 1).' - '.$newMax);
$lastMax = $newMax;
foreach ($items as $item)
DB::Aowow()->query('REPLACE INTO ?_items VALUES (?a)', array_values($item));