Major schedules & DB refactor

Refactored many calls for TimerManager's schedules throughout the source.
Switched all tables using MyISAM to InnoDB: on a multi-threaded environment such as this, table-locking is an instant no-no, and other gains MyISAM would have over InnoDB are minimal.
Altered getConnection() to properly throw an exception (good practice!) in case of no available connection instead of a mere null.
This commit is contained in:
ronancpl
2017-11-09 20:20:21 -02:00
parent 9677e6f3f5
commit c46ff82929
35 changed files with 600 additions and 374 deletions
+10 -10
View File
@@ -206,7 +206,7 @@ CREATE TABLE IF NOT EXISTS `temp_data` (
`chance` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`dropperid`, `itemid`),
KEY `mobid` (`dropperid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=0 ;
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=0 ;
INSERT IGNORE INTO `temp_data` (`id`, `dropperid`, `itemid`, `minimum_quantity`, `maximum_quantity`, `questid`, `chance`) VALUES
(1, 9400121, 4000138, 1, 1, 0, 600000),
@@ -15929,7 +15929,7 @@ CREATE TABLE IF NOT EXISTS `monsterbook` (
`charid` int(11) unsigned NOT NULL,
`cardid` int(11) NOT NULL,
`level` int(1) DEFAULT '1'
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE IF NOT EXISTS `monstercarddata` (
`id` int(11) NOT NULL AUTO_INCREMENT,
@@ -15937,7 +15937,7 @@ CREATE TABLE IF NOT EXISTS `monstercarddata` (
`mobid` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE KEY `id` (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=309 ;
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=309 ;
INSERT INTO `monstercarddata` (`id`, `cardid`, `mobid`) VALUES
(1, 2380000, 100100),
@@ -16313,7 +16313,7 @@ CREATE TABLE IF NOT EXISTS `nxcode` (
`type` int(11) NOT NULL DEFAULT '0',
`item` int(11) NOT NULL DEFAULT '10000',
PRIMARY KEY (`code`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE IF NOT EXISTS `nxcoupons` (
`id` int(11) NOT NULL AUTO_INCREMENT,
@@ -16418,7 +16418,7 @@ CREATE TABLE IF NOT EXISTS `questactions` (
`status` int(11) NOT NULL DEFAULT '0',
`data` blob NOT NULL,
PRIMARY KEY (`questactionid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
CREATE TABLE IF NOT EXISTS `questprogress` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
@@ -16434,7 +16434,7 @@ CREATE TABLE IF NOT EXISTS `questrequirements` (
`status` int(11) NOT NULL DEFAULT '0',
`data` blob NOT NULL,
PRIMARY KEY (`questrequirementid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
CREATE TABLE IF NOT EXISTS `queststatus` (
`queststatusid` int(10) unsigned NOT NULL AUTO_INCREMENT,
@@ -16456,7 +16456,7 @@ CREATE TABLE IF NOT EXISTS `reactordrops` (
`questid` int(5) NOT NULL DEFAULT '-1',
PRIMARY KEY (`reactordropid`),
KEY `reactorid` (`reactorid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 PACK_KEYS=1 AUTO_INCREMENT=841 ;
) ENGINE=InnoDB DEFAULT CHARSET=latin1 PACK_KEYS=1 AUTO_INCREMENT=841 ;
INSERT INTO `reactordrops` (`reactordropid`, `reactorid`, `itemid`, `chance`, `questid`) VALUES
(1, 2001, 4031161, 1, 1008),
@@ -17339,7 +17339,7 @@ CREATE TABLE IF NOT EXISTS `shopitems` (
`pitch` int(11) NOT NULL DEFAULT '0',
`position` int(11) NOT NULL COMMENT 'sort is an arbitrary field designed to give leeway when modifying shops. The lowest number is 104 and it increments by 4 for each item to allow decent space for swapping/inserting/removing items.',
PRIMARY KEY (`shopitemid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=20047 ;
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=20047 ;
INSERT INTO `shopitems` (`shopitemid`, `shopid`, `itemid`, `price`, `pitch`, `position`) VALUES
(1, 11000, 1332005, 500, 0, 104),
@@ -20967,7 +20967,7 @@ CREATE TABLE IF NOT EXISTS `shops` (
`shopid` int(10) unsigned NOT NULL AUTO_INCREMENT,
`npcid` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`shopid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=10000000 ;
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=10000000 ;
INSERT INTO `shops` (`shopid`, `npcid`) VALUES
(11000, 11000),
@@ -21256,7 +21256,7 @@ CREATE TABLE IF NOT EXISTS `skillmacros` (
`name` varchar(13) DEFAULT NULL,
`shout` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
CREATE TABLE IF NOT EXISTS `skills` (
`id` int(11) NOT NULL AUTO_INCREMENT,
+2 -2
View File
@@ -19885,7 +19885,7 @@ USE `maplesolaxia`;
PRIMARY KEY (`id`),
UNIQUE KEY (`dropperid`, `itemid`),
KEY `mobid` (`dropperid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
#pass (sorted) data from one table to another
INSERT INTO drop_data (dropperid, itemid, minimum_quantity, maximum_quantity, questid, chance)
@@ -21223,7 +21223,7 @@ USE `maplesolaxia`;
`mobid` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE KEY `id` (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
INSERT INTO `monstercarddata` (`cardid`, `mobid`) (SELECT itemid, min(dropperid) FROM drop_data where itemid>=2380000 and itemid<2390000 group by itemid);