SQL: Characters db storage type cleanup #1 - Note:
- MySQL numeric types can NOT be altered in value range or or storage size at all, so things like INT(32) are entirely pointless. As TC currently doesn't use the display width of numeric types, use the default width to avoid confusion. (see MySQL numeric types docs) - Timestamps can be stored as INT(10) UNSIGNED. As the max value of this type is 4294967295 which translates into year 2106 using it as timestamp we are NOT affected by the year 2038 bug. If the timestamp needs to be negative in some cases, i.e. for displaying infinity using -1, use BIGINT(20) instead. - Do NOT set ROW_FORMAT for InnoDB tables unless you specifically want COMPRESSED tables (which we don't for performance reasons). MySQL will chose the appropriate ROW_FORMAT by itself depending on the innodb_file_format setting of the server. (FIXED is only available for MyISAM) - Even though VARCHAR does require less storage space than CHAR for values with variable length, the length still needs to be chosen wisely as this doesn't apply to memory consumption.
This commit is contained in:
@@ -574,14 +574,14 @@ void AchievementMgr::LoadFromDB(PreparedQueryResult achievementResult, PreparedQ
|
||||
do
|
||||
{
|
||||
Field* fields = achievementResult->Fetch();
|
||||
uint32 achievement_id = fields[0].GetUInt32();
|
||||
uint32 achievement_id = fields[0].GetUInt16();
|
||||
|
||||
// don't must happen: cleanup at server startup in sAchievementMgr->LoadCompletedAchievements()
|
||||
if (!sAchievementStore.LookupEntry(achievement_id))
|
||||
continue;
|
||||
|
||||
CompletedAchievementData& ca = m_completedAchievements[achievement_id];
|
||||
ca.date = time_t(fields[1].GetUInt64());
|
||||
ca.date = time_t(fields[1].GetUInt32());
|
||||
ca.changed = false;
|
||||
}
|
||||
while (achievementResult->NextRow());
|
||||
@@ -592,9 +592,9 @@ void AchievementMgr::LoadFromDB(PreparedQueryResult achievementResult, PreparedQ
|
||||
do
|
||||
{
|
||||
Field* fields = criteriaResult->Fetch();
|
||||
uint32 id = fields[0].GetUInt32();
|
||||
uint32 id = fields[0].GetUInt16();
|
||||
uint32 counter = fields[1].GetUInt32();
|
||||
time_t date = time_t(fields[2].GetUInt64());
|
||||
time_t date = time_t(fields[2].GetUInt32());
|
||||
|
||||
AchievementCriteriaEntry const* criteria = sAchievementCriteriaStore.LookupEntry(id);
|
||||
if (!criteria)
|
||||
|
||||
@@ -198,9 +198,9 @@ bool ArenaTeam::LoadArenaTeamFromDB(QueryResult arenaTeamDataResult)
|
||||
m_CaptainGuid = MAKE_NEW_GUID(fields[2].GetUInt32(), 0, HIGHGUID_PLAYER);
|
||||
m_Type = fields[3].GetUInt32();
|
||||
m_BackgroundColor = fields[4].GetUInt32();
|
||||
m_EmblemStyle = fields[5].GetUInt32();
|
||||
m_EmblemStyle = fields[5].GetUInt8();
|
||||
m_EmblemColor = fields[6].GetUInt32();
|
||||
m_BorderStyle = fields[7].GetUInt32();
|
||||
m_BorderStyle = fields[7].GetUInt8();
|
||||
m_BorderColor = fields[8].GetUInt32();
|
||||
//load team stats
|
||||
m_stats.rating = fields[9].GetUInt32();
|
||||
|
||||
@@ -604,7 +604,7 @@ void WorldSession::LoadAccountData(PreparedQueryResult result, uint32 mask)
|
||||
do
|
||||
{
|
||||
Field *fields = result->Fetch();
|
||||
uint32 type = fields[0].GetUInt32();
|
||||
uint32 type = fields[0].GetUInt8();
|
||||
if (type >= NUM_ACCOUNT_DATA_TYPES)
|
||||
{
|
||||
sLog->outError("Table `%s` have invalid account data type (%u), ignore.", mask == GLOBAL_CACHE_MASK ? "account_data" : "character_account_data", type);
|
||||
@@ -617,7 +617,7 @@ void WorldSession::LoadAccountData(PreparedQueryResult result, uint32 mask)
|
||||
continue;
|
||||
}
|
||||
|
||||
m_accountData[type].Time = fields[1].GetUInt32();
|
||||
m_accountData[type].Time = time_t(fields[1].GetUInt32());
|
||||
m_accountData[type].Data = fields[2].GetString();
|
||||
}
|
||||
while (result->NextRow());
|
||||
|
||||
Reference in New Issue
Block a user