Go Back   EQEmulator Home > EQEmulator Forums > Development > Development::Bots

Development::Bots Forum for bots.

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 10-13-2015, 05:39 PM
Uleat's Avatar
Uleat
Developer
 
Join Date: Apr 2012
Location: North Carolina
Posts: 2,815
Exclamation Special Note For Bots Database Backups...

After reading through the forums for bots issues, and having experienced this myself, I discovered an issue involving database backups.

I know this condition exists with the current eqemu_update.pl backup routine..but, it may apply to other backup techniques as well.


When sourcing a backup file into a clean database, you may get an error saying that the GetMobType() function could not be found.

This is due to the fact that the functions have not been included in the backup and one of the database views calls for it.


There are currently two that you need for proper server operation.

Which versions you need are dependent on what version your bots database is at.


For older, pre-update script, databases, where there is NO underscore after 'bot' in the table name:
Code:
DELIMITER $$

CREATE FUNCTION `GetMobType` (mob_name VARCHAR(64)) RETURNS CHAR(1)
BEGIN
	DECLARE Result CHAR(1);
	
	SET Result = NULL;
	
	IF ((SELECT COUNT(*) FROM `character_data` WHERE `name` = mob_name) > 0) THEN
		SET Result = 'C';
	ELSEIF ((SELECT COUNT(*) FROM `bots` WHERE `Name` = mob_name) > 0) THEN
		SET Result = 'B';
	END IF;
	
	RETURN Result;
END$$

CREATE FUNCTION `GetMobTypeById` (mob_id INTEGER UNSIGNED) RETURNS CHAR(1)
BEGIN
	DECLARE Result CHAR(1);
	
	SET Result = NULL;
	
	IF ((select `id` from `character_data` where `id` = mob_id) > 0) THEN
		SET Result = 'C';
	ELSEIF ((select `bot_id` from `bots` where `BotID` = mob_id) > 0) THEN
		SET Result = 'B';
	END IF;
	
	RETURN Result;
END$$

DELIMITER ;
Note: If you're using a pre-'Player Profile' conversion database, you will need to change `character_data` to `character_` in both of the above functions.



For newer databases where `db_version`.`bots_version` is set to 9000 or higher..in particular, using the table naming scheme 'bot_%' :
Code:
DELIMITER $$

CREATE FUNCTION `GetMobType` (mob_name VARCHAR(64)) RETURNS CHAR(1)
BEGIN
	DECLARE Result CHAR(1);
	
	SET Result = NULL;
	
	IF ((SELECT COUNT(*) FROM `character_data` WHERE `name` = mob_name) > 0) THEN
		SET Result = 'C';
	ELSEIF ((SELECT COUNT(*) FROM `bot_data` WHERE `name` = mob_name) > 0) THEN
		SET Result = 'B';
	END IF;
	
	RETURN Result;
END$$

CREATE FUNCTION `GetMobTypeById` (mob_id INTEGER UNSIGNED) RETURNS CHAR(1)
BEGIN
	DECLARE Result CHAR(1);
	
	SET Result = NULL;
	
	IF ((select `id` from `character_data` where `id` = mob_id) > 0) THEN
		SET Result = 'C';
	ELSEIF ((select `bot_id` from `bot_data` where `bot_id` = mob_id) > 0) THEN
		SET Result = 'B';
	END IF;
	
	RETURN Result;
END$$

DELIMITER ;

For whichever version you have, just run that as a query prior to sourcing in your backup file and that should alleviate the error..and set things
somewhat straight.

There are a few threads where the issue would be resolved using this procedure.


Note: Future updates will probably eliminate the need for views and functions altogether..but, this info will still be needed for older databases.
__________________
Uleat of Bertoxxulous

Compilin' Dirty

Last edited by Uleat; 10-13-2015 at 08:37 PM..
Reply With Quote
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 12:00 PM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3