Core/DataStores: Support non-uint32 ID fields

This commit is contained in:
Shauren
2025-03-02 13:45:26 +01:00
parent 49aa298006
commit dac15a32a6

View File

@@ -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];
}