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:
leak
2012-03-28 19:46:38 +02:00
parent 6237ddac34
commit 7309ee5621
9 changed files with 48 additions and 36 deletions
+5 -13
View File
@@ -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);
}