Compat/SQL

* make ON DUPLICATE KEY UPDATE queries compatible with both MySQL8 and MariaDB by providing update values from php
This commit is contained in:
Sarjuuk
2025-01-26 13:50:12 +01:00
parent 5309843d77
commit 88da3588e5
3 changed files with 5 additions and 5 deletions

View File

@@ -37,7 +37,7 @@ CLISetup::registerSetup("sql", new class extends SetupScript
$data = DB::World()->select($q);
foreach ($data as $d)
DB::Aowow()->query('INSERT INTO ?_quests_startend (?#) VALUES (?a) AS newQSE(`t`, `ti`, `qi`, `m`, `ei`) ON DUPLICATE KEY UPDATE `method` = `method` | newQSE.`m`, `eventId` = IF(`eventId` = 0, newQSE.`ei`, `eventId`)', array_keys($d), array_values($d));
DB::Aowow()->query('INSERT INTO ?_quests_startend (?#) VALUES (?a) ON DUPLICATE KEY UPDATE `method` = `method` | ?d, `eventId` = IF(`eventId` = 0, ?d, `eventId`)', array_keys($d), array_values($d), $d['method'], $d['eventId']);
}
// update quests without start as unavailable