mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/DataStores: Removed unused code from DB2DatabaseLoader
This commit is contained in:
@@ -30,7 +30,7 @@ DB2LoadInfo::DB2LoadInfo(DB2FieldMeta const* fields, std::size_t fieldCount, DB2
|
||||
|
||||
static char const* nullStr = "";
|
||||
|
||||
char* DB2DatabaseLoader::Load(bool custom, uint32& records, char**& indexTable, char*& stringHolders, std::vector<char*>& stringPool)
|
||||
char* DB2DatabaseLoader::Load(bool custom, uint32& records, char**& indexTable, std::vector<char*>& stringPool)
|
||||
{
|
||||
// Even though this query is executed only once, prepared statement is used to send data from mysql server in binary format
|
||||
HotfixDatabasePreparedStatement* stmt = HotfixDatabase.GetPreparedStatement(_loadInfo->Statement);
|
||||
@@ -48,22 +48,6 @@ char* DB2DatabaseLoader::Load(bool custom, uint32& records, char**& indexTable,
|
||||
|
||||
// we store flat holders pool as single memory block
|
||||
std::size_t stringFields = _loadInfo->GetStringFieldCount(false);
|
||||
std::size_t localizedStringFields = _loadInfo->GetStringFieldCount(true);
|
||||
|
||||
// each string field at load have array of string for each locale
|
||||
std::size_t stringHoldersRecordPoolSize = localizedStringFields * sizeof(LocalizedString) + (stringFields - localizedStringFields) * sizeof(char*);
|
||||
|
||||
if (stringFields)
|
||||
{
|
||||
std::size_t stringHoldersPoolSize = stringHoldersRecordPoolSize * result->GetRowCount();
|
||||
stringHolders = new char[stringHoldersPoolSize];
|
||||
|
||||
// DB2 strings expected to have at least empty string
|
||||
for (std::size_t i = 0; i < stringHoldersPoolSize / sizeof(char*); ++i)
|
||||
((char const**)stringHolders)[i] = nullStr;
|
||||
}
|
||||
else
|
||||
stringHolders = nullptr;
|
||||
|
||||
// Resize index table
|
||||
uint32 indexTableSize = records;
|
||||
|
||||
@@ -36,7 +36,7 @@ class TC_SHARED_API DB2DatabaseLoader
|
||||
public:
|
||||
DB2DatabaseLoader(std::string const& storageName, DB2LoadInfo const* loadInfo) : _storageName(storageName), _loadInfo(loadInfo) { }
|
||||
|
||||
char* Load(bool custom, uint32& records, char**& indexTable, char*& stringHolders, std::vector<char*>& stringPool);
|
||||
char* Load(bool custom, uint32& records, char**& indexTable, std::vector<char*>& stringPool);
|
||||
void LoadStrings(bool custom, LocaleConstant locale, uint32 records, char** indexTable, std::vector<char*>& stringPool);
|
||||
static char* AddString(char const** holder, std::string const& value);
|
||||
|
||||
|
||||
@@ -127,16 +127,8 @@ void DB2StorageBase::LoadFromDB(char**& indexTable)
|
||||
{
|
||||
DB2DatabaseLoader loader(_fileName, _loadInfo);
|
||||
|
||||
auto loadTable = [&](bool custom)
|
||||
{
|
||||
char* extraStringHolders = nullptr;
|
||||
_dataTableEx[custom ? 1 : 0] = loader.Load(custom, _indexTableSize, indexTable, extraStringHolders, _stringPool);
|
||||
if (extraStringHolders)
|
||||
_stringPool.push_back(extraStringHolders);
|
||||
};
|
||||
|
||||
loadTable(false);
|
||||
loadTable(true);
|
||||
_dataTableEx[0] = loader.Load(false, _indexTableSize, indexTable, _stringPool);
|
||||
_dataTableEx[1] = loader.Load(true, _indexTableSize, indexTable, _stringPool);
|
||||
_stringPool.shrink_to_fit();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user