EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Development::Bug Reports (https://www.eqemulator.org/forums/forumdisplay.php?f=591)
-   -   BaseGuildManager::DBSetGuild() (https://www.eqemulator.org/forums/showthread.php?t=31696)

c0ncrete 07-18-2010 08:24 PM

BaseGuildManager::DBSetGuild()
 
Using quest::SetGuild() to change a character's guild ends up putting them in multiple guilds. From what I understand, this is because DBSetGuild() uses 'REPLACE INTO' in the query and the guild_members table doesn't have a PRIMARY KEY or UNIQUE index.

This is from the MySQL reference manual on REPLACE INTO:
Quote:

Note that unless the table has a PRIMARY KEY or UNIQUE index, using a REPLACE statement makes no sense. It becomes equivalent to INSERT, because there is no index to be used to determine whether a new row duplicates another.

c0ncrete 07-18-2010 08:37 PM

This fixes the issue:

Code:

ALTER TABLE `guild_members` ADD UNIQUE INDEX `char_id`(`char_id`);


All times are GMT -4. The time now is 07:18 PM.

Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.