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

@@ -301,7 +301,7 @@ $lang = array(
'groups' => array(
-1 => "None", "Testeur", "Administrateur", "Éditeur", "Modérateur", "Bureaucrate",
"Développeur", "VIP", "Bloggeur", "Premium", "Traducteur", "Agent de ventes",
"Gestionnaire de capture d'écran","Gestionnaire de vidéos" "Partenaire API", "En attente"
"Gestionnaire de capture d'écran","Gestionnaire de vidéos", "Partenaire API", "En attente"
),
// signIn
'doSignIn' => "Connexion à votre compte Aowow",

View File

@@ -91,12 +91,13 @@ function creature(array $ids = [])
creature_template_locale ctl8 ON ct.entry = ctl8.entry AND ctl8.`locale` = "ruRU"
LEFT JOIN
instance_encounters ie ON ie.creditEntry = ct.entry AND ie.creditType = 0
{
WHERE
ct.entry IN (?a)
ct.entry > ?d
{
AND ct.entry IN (?a)
}
LIMIT
?d, ?d';
?d';
$dummyQuery = '
UPDATE
@@ -124,12 +125,14 @@ function creature(array $ids = [])
c.modelId = cdi.modelId,
c.iconString = cdi.iconString';
$offset = 0;
while ($npcs = DB::World()->select($baseQuery, NPC_CU_INSTANCE_BOSS, $ids ?: DBSIMPLE_SKIP, $offset, SqlGen::$stepSize))
$lastMax = 0;
while ($npcs = DB::World()->select($baseQuery, NPC_CU_INSTANCE_BOSS, $lastMax, $ids ?: DBSIMPLE_SKIP, SqlGen::$stepSize))
{
CLISetup::log(' * sets '.($offset + 1).' - '.($offset + count($npcs)));
$newMax = max(array_column($npcs, 'entry'));
$offset += SqlGen::$stepSize;
CLISetup::log(' * sets '.($lastMax + 1).' - '.$newMax);
$lastMax = $newMax;
foreach ($npcs as $npc)
DB::Aowow()->query('REPLACE INTO ?_creature VALUES (?a)', array_values($npc));

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));

View File

@@ -75,14 +75,15 @@ function objects(array $ids = [])
gameobject_template_locale gtl8 ON go.entry = gtl8.entry AND gtl8.`locale` = "ruRU"
LEFT JOIN
gameobject_questitem gqi ON gqi.GameObjectEntry = go.entry
{
WHERE
go.entry IN (?a)
go.entry > ?d
{
AND go.entry IN (?a)
}
GROUP BY
go.entry
LIMIT
?d, ?d';
?d';
$updateQuery = '
UPDATE
@@ -100,12 +101,14 @@ function objects(array $ids = [])
o.id IN (?a)
}';
$offset = 0;
while ($objects = DB::World()->select($baseQuery, $ids ?: DBSIMPLE_SKIP, $offset, SqlGen::$stepSize))
$lastMax = 0;
while ($objects = DB::World()->select($baseQuery, $lastMax, $ids ?: DBSIMPLE_SKIP, SqlGen::$stepSize))
{
CLISetup::log(' * sets '.($offset + 1).' - '.($offset + count($objects)));
$newMax = max(array_column($objects, 'entry'));
$offset += SqlGen::$stepSize;
CLISetup::log(' * sets '.($lastMax + 1).' - '.$newMax);
$lastMax = $newMax;
foreach ($objects as $o)
DB::Aowow()->query('REPLACE INTO ?_objects VALUES (?a)', array_values($o));

View File

@@ -101,12 +101,13 @@ function quests(array $ids = [])
locales_quest lq ON q.ID = lq.Id
LEFT JOIN
game_event_seasonal_questrelation gesqr ON gesqr.questId = q.ID
{
WHERE
q.ID IN (?a)
q.Id > ?d
{
AND q.Id IN (?a)
}
LIMIT
?d, ?d';
?d';
$xpQuery = '
UPDATE
@@ -140,12 +141,14 @@ function quests(array $ids = [])
}';
$offset = 0;
while ($quests = DB::World()->select($baseQuery, $ids ?: DBSIMPLE_SKIP, $offset, SqlGen::$stepSize))
$lastMax = 0;
while ($quests = DB::World()->select($baseQuery, $lastMax, $ids ?: DBSIMPLE_SKIP, SqlGen::$stepSize))
{
CLISetup::log(' * sets '.($offset + 1).' - '.($offset + count($quests)));
$newMax = max(array_column($quests, 'Id'));
$offset += SqlGen::$stepSize;
CLISetup::log(' * sets '.($lastMax + 1).' - '.$newMax);
$lastMax = $newMax;
foreach ($quests as $q)
DB::Aowow()->query('REPLACE INTO ?_quests VALUES (?a)', array_values($q));

View File

@@ -110,8 +110,10 @@ function spell()
0 AS spellDifficulty
FROM
spell_dbc
WHERE
Id > ?d
LIMIT
?d, ?d';
?d';
$baseQuery = '
SELECT
@@ -209,19 +211,23 @@ function spell()
dbc_spellradius sr2 ON s.effect2RadiusId = sr2.Id
LEFT JOIN
dbc_spellradius sr3 ON s.effect3RadiusId = sr3.Id
WHERE
s.Id > ?d
LIMIT
?d, ?d';
?d';
$serverside = [];
// merge serverside spells into dbc_spell (should not affect other scripts)
$offset = 0;
$lastMax = 0;
CLISetup::log(' - merging serverside spells into spell.dbc');
while ($spells = DB::World()->select($ssQuery, $offset, SqlGen::$stepSize))
while ($spells = DB::World()->select($ssQuery, $lastMax, SqlGen::$stepSize))
{
CLISetup::log(' * sets '.($offset + 1).' - '.($offset + count($spells)));
$newMax = max(array_column($spells, 'Id'));
$offset += SqlGen::$stepSize;
CLISetup::log(' * sets '.($lastMax + 1).' - '.$newMax);
$lastMax = $newMax;
foreach ($spells as $id => $spell)
{
@@ -231,13 +237,15 @@ function spell()
}
// merge everything into aowow_spell
$offset = 0;
$lastMax = 0;
CLISetup::log(' - filling aowow_spell');
while ($spells = DB::Aowow()->select($baseQuery, $offset, SqlGen::$stepSize))
while ($spells = DB::Aowow()->select($baseQuery, $lastMax, SqlGen::$stepSize))
{
CLISetup::log(' * sets '.($offset + 1).' - '.($offset + count($spells)));
$newMax = max(array_column($spells, 'Id'));
$offset += SqlGen::$stepSize;
CLISetup::log(' * sets '.($lastMax + 1).' - '.$newMax);
$lastMax = $newMax;
foreach ($spells as $spell)
DB::Aowow()->query('REPLACE INTO ?_spell VALUES (?a)', array_values($spell));