diff options
| -rw-r--r-- | sql/base/auth_database.sql | 37 | ||||
| -rw-r--r-- | sql/updates/auth/2012_03_28_04_logs.sql | 5 | ||||
| -rw-r--r-- | sql/updates/auth/2012_03_28_05_realmcharacters.sql | 4 | ||||
| -rw-r--r-- | sql/updates/auth/2012_03_28_06_realmlist.sql | 6 | ||||
| -rw-r--r-- | sql/updates/auth/2012_03_28_07_uptime.sql | 6 | ||||
| -rwxr-xr-x | src/server/authserver/Realms/RealmList.cpp | 4 | ||||
| -rwxr-xr-x | src/server/authserver/Realms/RealmList.h | 2 | ||||
| -rwxr-xr-x | src/server/game/World/World.cpp | 18 | ||||
| -rwxr-xr-x | src/server/shared/Logging/Log.cpp | 2 |
9 files changed, 48 insertions, 36 deletions
diff --git a/sql/base/auth_database.sql b/sql/base/auth_database.sql index 20bb870ff56..5803529da1e 100644 --- a/sql/base/auth_database.sql +++ b/sql/base/auth_database.sql @@ -140,11 +140,11 @@ DROP TABLE IF EXISTS `logs`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `logs` ( - `time` int(14) NOT NULL, - `realm` int(4) NOT NULL, - `type` int(4) NOT NULL, - `string` text -) ENGINE=MyISAM DEFAULT CHARSET=latin1; + `time` int(10) unsigned NOT NULL, + `realm` int(10) unsigned NOT NULL, + `type` tinyint(3) unsigned NOT NULL, + `string` text CHARACTER SET latin1 +) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -164,12 +164,12 @@ DROP TABLE IF EXISTS `realmcharacters`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `realmcharacters` ( - `realmid` int(11) unsigned NOT NULL DEFAULT '0', - `acctid` bigint(20) unsigned NOT NULL, + `realmid` int(10) unsigned NOT NULL DEFAULT '0', + `acctid` int(10) unsigned NOT NULL, `numchars` tinyint(3) unsigned NOT NULL DEFAULT '0', PRIMARY KEY (`realmid`,`acctid`), KEY `acctid` (`acctid`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Realm Character Tracker'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Realm Character Tracker'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -189,19 +189,19 @@ DROP TABLE IF EXISTS `realmlist`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `realmlist` ( - `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(32) NOT NULL DEFAULT '', - `address` varchar(32) NOT NULL DEFAULT '127.0.0.1', - `port` int(11) NOT NULL DEFAULT '8085', + `address` varchar(15) NOT NULL DEFAULT '127.0.0.1', + `port` smallint(5) unsigned NOT NULL DEFAULT '8085', `icon` tinyint(3) unsigned NOT NULL DEFAULT '0', `flag` tinyint(3) unsigned NOT NULL DEFAULT '2', `timezone` tinyint(3) unsigned NOT NULL DEFAULT '0', `allowedSecurityLevel` tinyint(3) unsigned NOT NULL DEFAULT '0', `population` float unsigned NOT NULL DEFAULT '0', - `gamebuild` int(11) unsigned NOT NULL DEFAULT '12340', + `gamebuild` int(10) unsigned NOT NULL DEFAULT '12340', PRIMARY KEY (`id`), UNIQUE KEY `idx_name` (`name`) -) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Realm System'; +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COMMENT='Realm System'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -222,14 +222,13 @@ DROP TABLE IF EXISTS `uptime`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `uptime` ( - `realmid` int(11) unsigned NOT NULL, - `starttime` bigint(20) unsigned NOT NULL DEFAULT '0', - `startstring` varchar(64) NOT NULL DEFAULT '', - `uptime` bigint(20) unsigned NOT NULL DEFAULT '0', + `realmid` int(10) unsigned NOT NULL, + `starttime` int(10) unsigned NOT NULL DEFAULT '0', + `uptime` int(10) unsigned NOT NULL DEFAULT '0', `maxplayers` smallint(5) unsigned NOT NULL DEFAULT '0', `revision` varchar(255) NOT NULL DEFAULT 'Trinitycore', PRIMARY KEY (`realmid`,`starttime`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Uptime system'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Uptime system'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -250,4 +249,4 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2012-03-28 16:44:39 +-- Dump completed on 2012-03-28 18:26:06 diff --git a/sql/updates/auth/2012_03_28_04_logs.sql b/sql/updates/auth/2012_03_28_04_logs.sql new file mode 100644 index 00000000000..4c837a47ed1 --- /dev/null +++ b/sql/updates/auth/2012_03_28_04_logs.sql @@ -0,0 +1,5 @@ +ALTER TABLE `logs` + CHANGE `time` `time` INT(10) UNSIGNED NOT NULL, + CHANGE `realm` `realm` INT(10) UNSIGNED NOT NULL, + CHANGE `type` `type` TINYINT(3) UNSIGNED NOT NULL, + ROW_FORMAT=DEFAULT ENGINE=INNODB; diff --git a/sql/updates/auth/2012_03_28_05_realmcharacters.sql b/sql/updates/auth/2012_03_28_05_realmcharacters.sql new file mode 100644 index 00000000000..e50b3c3f331 --- /dev/null +++ b/sql/updates/auth/2012_03_28_05_realmcharacters.sql @@ -0,0 +1,4 @@ +ALTER TABLE `realmcharacters` + CHANGE `realmid` `realmid` INT(10) UNSIGNED DEFAULT 0 NOT NULL, + CHANGE `acctid` `acctid` INT(10) UNSIGNED NOT NULL, + ROW_FORMAT=DEFAULT ENGINE=INNODB; diff --git a/sql/updates/auth/2012_03_28_06_realmlist.sql b/sql/updates/auth/2012_03_28_06_realmlist.sql new file mode 100644 index 00000000000..e5e7b2e00d4 --- /dev/null +++ b/sql/updates/auth/2012_03_28_06_realmlist.sql @@ -0,0 +1,6 @@ +ALTER TABLE `realmlist` + CHANGE `id` `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, + CHANGE `address` `address` VARCHAR(15) DEFAULT '127.0.0.1' NOT NULL, + CHANGE `port` `port` SMALLINT(5) UNSIGNED DEFAULT '8085' NOT NULL, + CHANGE `gamebuild` `gamebuild` INT(10) UNSIGNED DEFAULT '12340' NOT NULL, + ROW_FORMAT=DEFAULT ENGINE=INNODB;
\ No newline at end of file diff --git a/sql/updates/auth/2012_03_28_07_uptime.sql b/sql/updates/auth/2012_03_28_07_uptime.sql new file mode 100644 index 00000000000..0ea4e3321df --- /dev/null +++ b/sql/updates/auth/2012_03_28_07_uptime.sql @@ -0,0 +1,6 @@ +ALTER TABLE `uptime` + DROP COLUMN `startstring`, + CHANGE `realmid` `realmid` INT(10) UNSIGNED NOT NULL, + CHANGE `starttime` `starttime` INT(10) UNSIGNED DEFAULT 0 NOT NULL, + CHANGE `uptime` `uptime` INT(10) UNSIGNED DEFAULT 0 NOT NULL, + ROW_FORMAT=DEFAULT ENGINE=INNODB; diff --git a/src/server/authserver/Realms/RealmList.cpp b/src/server/authserver/Realms/RealmList.cpp index efcced51089..f856156825d 100755 --- a/src/server/authserver/Realms/RealmList.cpp +++ b/src/server/authserver/Realms/RealmList.cpp @@ -31,7 +31,7 @@ void RealmList::Initialize(uint32 updateInterval) UpdateRealms(true); } -void RealmList::UpdateRealm(uint32 ID, const std::string& name, const std::string& address, uint32 port, uint8 icon, RealmFlags flag, uint8 timezone, AccountTypes allowedSecurityLevel, float popu, uint32 build) +void RealmList::UpdateRealm(uint32 ID, const std::string& name, const std::string& address, uint16 port, uint8 icon, RealmFlags flag, uint8 timezone, AccountTypes allowedSecurityLevel, float popu, uint32 build) { // Create new if not exist or update existed Realm& realm = m_realms[name]; @@ -82,7 +82,7 @@ void RealmList::UpdateRealms(bool init) uint32 realmId = fields[0].GetUInt32(); const std::string& name = fields[1].GetString(); const std::string& address = fields[2].GetString(); - uint32 port = fields[3].GetUInt32(); + uint16 port = fields[3].GetUInt16(); uint8 icon = fields[4].GetUInt8(); RealmFlags flag = RealmFlags(fields[5].GetUInt8()); uint8 timezone = fields[6].GetUInt8(); diff --git a/src/server/authserver/Realms/RealmList.h b/src/server/authserver/Realms/RealmList.h index 4d258953ae0..c8407b0fea1 100755 --- a/src/server/authserver/Realms/RealmList.h +++ b/src/server/authserver/Realms/RealmList.h @@ -71,7 +71,7 @@ public: private: void UpdateRealms(bool init=false); - void UpdateRealm(uint32 ID, const std::string& name, const std::string& address, uint32 port, uint8 icon, RealmFlags flag, uint8 timezone, AccountTypes allowedSecurityLevel, float popu, uint32 build); + void UpdateRealm(uint32 ID, const std::string& name, const std::string& address, uint16 port, uint8 icon, RealmFlags flag, uint8 timezone, AccountTypes allowedSecurityLevel, float popu, uint32 build); RealmMap m_realms; uint32 m_UpdateInterval; diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index 489278f63e6..9683d847f86 100755 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -1669,18 +1669,10 @@ void World::SetInitialWorldSettings() ///- Initialize game time and timers sLog->outString("Initialize game time and timers"); m_gameTime = time(NULL); - m_startTime=m_gameTime; - - tm local; - time_t curr; - time(&curr); - local=*(localtime(&curr)); // dereference and assign - char isoDate[128]; - sprintf(isoDate, "%04d-%02d-%02d %02d:%02d:%02d", - local.tm_year+1900, local.tm_mon+1, local.tm_mday, local.tm_hour, local.tm_min, local.tm_sec); + m_startTime = m_gameTime; - LoginDatabase.PExecute("INSERT INTO uptime (realmid, starttime, startstring, uptime, revision) VALUES('%u', " UI64FMTD ", '%s', 0, '%s')", - realmID, uint64(m_startTime), isoDate, _FULLVERSION); // One-time query + LoginDatabase.PExecute("INSERT INTO uptime (realmid, starttime, uptime, revision) VALUES(%u, %u, '%s', 0, '%s')", + realmID, uint32(m_startTime), _FULLVERSION); // One-time query m_timers[WUPDATE_WEATHERS].SetInterval(1*IN_MILLISECONDS); m_timers[WUPDATE_AUCTIONS].SetInterval(MINUTE*IN_MILLISECONDS); @@ -1965,10 +1957,10 @@ void World::Update(uint32 diff) PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_UPTIME_PLAYERS); - stmt->setUInt64(0, uint64(tmpDiff)); + stmt->setUInt32(0, tmpDiff); stmt->setUInt16(1, uint16(maxOnlinePlayers)); stmt->setUInt32(2, realmID); - stmt->setUInt64(3, uint64(m_startTime)); + stmt->setUInt32(3, uint32(m_startTime)); LoginDatabase.Execute(stmt); } diff --git a/src/server/shared/Logging/Log.cpp b/src/server/shared/Logging/Log.cpp index a9bb282cf86..0a53706fea2 100755 --- a/src/server/shared/Logging/Log.cpp +++ b/src/server/shared/Logging/Log.cpp @@ -382,7 +382,7 @@ void Log::outDB(LogTypes type, const char * str) PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_LOG); stmt->setInt32(0, realm); - stmt->setInt32(1, type); + stmt->setUInt8(1, uint8(type)); stmt->setString(2, logStr); LoginDatabase.Execute(stmt); |
