aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2025-03-02 13:45:26 +0100
committerOvahlord <dreadkiller@gmx.de>2025-04-06 19:23:53 +0200
commit67a1d17ae286f1aefb55ae3aa1060a31ab49c7cf (patch)
tree3ea41ddcbfe5e240dec23317b032f4798ae64812
parent9cfcebc2da46f56a3515c7e518682812c1371298 (diff)
Core/DataStores: Support non-uint32 ID fields
(cherry picked from commit dac15a32a6361a5e47e17b621828369b1b7a4d84)
-rw-r--r--src/common/DataStores/DB2FileLoader.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/common/DataStores/DB2FileLoader.cpp b/src/common/DataStores/DB2FileLoader.cpp
index 12df8086a45..d3dfa65bf90 100644
--- a/src/common/DataStores/DB2FileLoader.cpp
+++ b/src/common/DataStores/DB2FileLoader.cpp
@@ -746,7 +746,20 @@ unsigned char const* DB2FileLoaderRegularImpl::GetRawRecordData(uint32 recordNum
uint32 DB2FileLoaderRegularImpl::RecordGetId(uint8 const* record, uint32 recordIndex) const
{
if (_loadInfo->Meta->HasIndexFieldInData())
- return RecordGetVarInt<uint32>(record, _loadInfo->Meta->GetIndexField(), 0);
+ {
+ uint32 indexField = _loadInfo->Meta->GetIndexField();
+ switch (_loadInfo->Meta->Fields[indexField].Type)
+ {
+ case FT_INT:
+ return RecordGetVarInt<uint32>(record, indexField, 0);
+ case FT_BYTE:
+ return RecordGetVarInt<uint8>(record, indexField, 0);
+ case FT_SHORT:
+ return RecordGetVarInt<uint16>(record, indexField, 0);
+ default:
+ ABORT_MSG("Unhandled ID type %u in %s", uint32(_loadInfo->Meta->Fields[indexField].Type), _fileName);
+ }
+ }
return _idTable[recordIndex];
}