From 3ac790287aba5f7d7c3bccf79e608de9119e461a Mon Sep 17 00:00:00 2001 From: Shauren Date: Sat, 26 Oct 2019 23:58:29 +0200 Subject: Core/DataStores: Updated db2 structures to 8.2.5 --- src/common/DataStores/DB2FileLoader.cpp | 85 +++++++++++++++++++-------------- 1 file changed, 48 insertions(+), 37 deletions(-) (limited to 'src/common/DataStores/DB2FileLoader.cpp') diff --git a/src/common/DataStores/DB2FileLoader.cpp b/src/common/DataStores/DB2FileLoader.cpp index a6eb2c7fe87..f5029136c21 100644 --- a/src/common/DataStores/DB2FileLoader.cpp +++ b/src/common/DataStores/DB2FileLoader.cpp @@ -678,25 +678,28 @@ void DB2FileLoaderRegularImpl::FillParentLookup(char* dataTable) for (uint32 i = 0; i < _header->SectionCount; ++i) { DB2SectionHeader const& section = GetSection(i); - for (std::size_t j = 0; j < _parentIndexes[i][0].Entries.size(); ++j) + if (!section.TactId) { - uint32 parentId = _parentIndexes[i][0].Entries[j].ParentId; - char* recordData = &dataTable[(_parentIndexes[i][0].Entries[j].RecordIndex + recordIndexOffset) * recordSize]; - - switch (_loadInfo->Meta->Fields[_loadInfo->Meta->ParentIndexField].Type) + for (std::size_t j = 0; j < _parentIndexes[i][0].Entries.size(); ++j) { - case FT_SHORT: - *reinterpret_cast(&recordData[parentIdOffset]) = uint16(parentId); - break; - case FT_BYTE: - *reinterpret_cast(&recordData[parentIdOffset]) = uint8(parentId); - break; - case FT_INT: - *reinterpret_cast(&recordData[parentIdOffset]) = parentId; - break; - default: - ASSERT(false, "Unhandled parent id type '%c' found in %s", _loadInfo->Meta->Fields[_loadInfo->Meta->ParentIndexField].Type, _fileName); - break; + uint32 parentId = _parentIndexes[i][0].Entries[j].ParentId; + char* recordData = &dataTable[(_parentIndexes[i][0].Entries[j].RecordIndex + recordIndexOffset) * recordSize]; + + switch (_loadInfo->Meta->Fields[_loadInfo->Meta->ParentIndexField].Type) + { + case FT_SHORT: + *reinterpret_cast(&recordData[parentIdOffset]) = uint16(parentId); + break; + case FT_BYTE: + *reinterpret_cast(&recordData[parentIdOffset]) = uint8(parentId); + break; + case FT_INT: + *reinterpret_cast(&recordData[parentIdOffset]) = parentId; + break; + default: + ASSERT(false, "Unhandled parent id type '%c' found in %s", _loadInfo->Meta->Fields[_loadInfo->Meta->ParentIndexField].Type, _fileName); + break; + } } } recordIndexOffset += section.RecordCount; @@ -1383,25 +1386,28 @@ void DB2FileLoaderSparseImpl::FillParentLookup(char* dataTable) for (uint32 i = 0; i < _header->SectionCount; ++i) { DB2SectionHeader const& section = GetSection(i); - for (std::size_t j = 0; j < _parentIndexes[i][0].Entries.size(); ++j) + if (!section.TactId) { - uint32 parentId = _parentIndexes[i][0].Entries[j].ParentId; - char* recordData = &dataTable[(_parentIndexes[i][0].Entries[j].RecordIndex + recordIndexOffset) * recordSize]; - - switch (_loadInfo->Meta->Fields[_loadInfo->Meta->ParentIndexField].Type) + for (std::size_t j = 0; j < _parentIndexes[i][0].Entries.size(); ++j) { - case FT_SHORT: - *reinterpret_cast(&recordData[parentIdOffset]) = uint16(parentId); - break; - case FT_BYTE: - *reinterpret_cast(&recordData[parentIdOffset]) = uint8(parentId); - break; - case FT_INT: - *reinterpret_cast(&recordData[parentIdOffset]) = parentId; - break; - default: - ASSERT(false, "Unhandled parent id type '%c' found in %s", _loadInfo->Meta->Fields[_loadInfo->Meta->ParentIndexField].Type, _fileName); - break; + uint32 parentId = _parentIndexes[i][0].Entries[j].ParentId; + char* recordData = &dataTable[(_parentIndexes[i][0].Entries[j].RecordIndex + recordIndexOffset) * recordSize]; + + switch (_loadInfo->Meta->Fields[_loadInfo->Meta->ParentIndexField].Type) + { + case FT_SHORT: + *reinterpret_cast(&recordData[parentIdOffset]) = uint16(parentId); + break; + case FT_BYTE: + *reinterpret_cast(&recordData[parentIdOffset]) = uint8(parentId); + break; + case FT_INT: + *reinterpret_cast(&recordData[parentIdOffset]) = parentId; + break; + default: + ASSERT(false, "Unhandled parent id type '%c' found in %s", _loadInfo->Meta->Fields[_loadInfo->Meta->ParentIndexField].Type, _fileName); + break; + } } } recordIndexOffset += section.RecordCount; @@ -1873,6 +1879,13 @@ bool DB2FileLoader::Load(DB2FileSource* source, DB2FileLoadInfo const* loadInfo) if (loadInfo && !loadInfo->Meta->HasIndexFieldInData() && _header.RecordCount) idTable.reserve(_header.RecordCount); + if (_header.ParentLookupCount) + { + parentIndexes.resize(_header.SectionCount); + for (std::vector& parentIndexesForSection : parentIndexes) + parentIndexesForSection.resize(_header.ParentLookupCount); + } + for (uint32 i = 0; i < _header.SectionCount; ++i) { DB2SectionHeader const& section = _impl->GetSection(i); @@ -1917,9 +1930,7 @@ bool DB2FileLoader::Load(DB2FileSource* source, DB2FileLoadInfo const* loadInfo) if (_header.ParentLookupCount) { - parentIndexes.emplace_back(); - std::vector& parentIndexesForSection = parentIndexes.back(); - parentIndexesForSection.resize(_header.ParentLookupCount); + std::vector& parentIndexesForSection = parentIndexes[i]; for (uint32 j = 0; j < _header.ParentLookupCount; ++j) { DB2IndexDataInfo indexInfo; -- cgit v1.2.3