SQL: Auth db data type cleanup logs, realmcharacters, realmlist, uptime / Storage engine switched to InnoDB Note:
As for the redundant `uptime`.`startstring` being removed, this page might be of interest how to generate time strings from unix timestamps http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_from-unixtime
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
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);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user