23#include <fmt/ranges.h>
26#include <system_error>
27#include <unordered_map>
138 if (!strcmp(
Fields[ourIndex].
Name, fieldName))
145 return std::make_pair(-1, -1);
152 for (
uint32 i = 0; i < metaIndex; ++i)
171 std::unique_ptr<std::unique_ptr<
DB2PalletValue[]>[]> palletValues, std::unique_ptr<std::unique_ptr<
DB2PalletValue[]>[]> palletArrayValues,
172 std::unique_ptr<std::unordered_map<uint32, uint32>[]> commonValues) = 0;
176 virtual void SetAdditionalData(std::vector<uint32> idTable, std::vector<DB2RecordCopy> copyTable, std::vector<std::vector<DB2IndexData>> parentIndexes) = 0;
216 std::unique_ptr<std::unique_ptr<
DB2PalletValue[]>[]> palletValues, std::unique_ptr<std::unique_ptr<
DB2PalletValue[]>[]> palletArrayValues,
217 std::unique_ptr<std::unordered_map<uint32, uint32>[]> commonValues)
override;
221 void SetAdditionalData(std::vector<uint32> idTable, std::vector<DB2RecordCopy> copyTable, std::vector<std::vector<DB2IndexData>> parentIndexes)
override;
280 std::unique_ptr<std::unique_ptr<
DB2PalletValue[]>[]> palletValues, std::unique_ptr<std::unique_ptr<
DB2PalletValue[]>[]> palletArrayValues,
281 std::unique_ptr<std::unordered_map<uint32, uint32>[]> commonValues)
override;
285 void SetAdditionalData(std::vector<uint32> idTable, std::vector<DB2RecordCopy> copyTable, std::vector<std::vector<DB2IndexData>> parentIndexes)
override;
338 _stringTable(nullptr)
343 std::unique_ptr<std::unique_ptr<
DB2PalletValue[]>[]> palletValues, std::unique_ptr<std::unique_ptr<
DB2PalletValue[]>[]> palletArrayValues,
344 std::unique_ptr<std::unordered_map<uint32, uint32>[]> commonValues)
361 uint32 sectionDataStart = 0;
362 uint32 sectionStringTableStart = 0;
363 for (
uint32 i = 0; i < section; ++i)
366 sectionStringTableStart +=
_sections[i].StringTableSize;
396 using index_entry_t =
char*;
398 indexTableSize = maxi;
399 indexTable =
new index_entry_t[maxi];
400 memset(indexTable, 0, maxi *
sizeof(index_entry_t));
425 indexTable[indexVal] = &dataTable[offset];
430 *
reinterpret_cast<uint32*
>(&dataTable[offset]) = indexVal;
442 *
reinterpret_cast<float*
>(&dataTable[offset]) =
RecordGetFloat(rawRecord, x, z);
446 *
reinterpret_cast<uint32*
>(&dataTable[offset]) = RecordGetVarInt<uint32>(rawRecord, x, z);
462 for (
char const*& localeStr :
reinterpret_cast<LocalizedString*
>(&dataTable[offset])->Str)
468 *
reinterpret_cast<char const**
>(&dataTable[offset]) =
EmptyDb2String;
469 offset +=
sizeof(
char*);
472 ABORT_MSG(
"Unknown format character '%c' found in %s meta for field %s",
487 *
reinterpret_cast<uint32*
>(&dataTable[offset]) = 0;
491 *
reinterpret_cast<uint8*
>(&dataTable[offset]) = 0;
495 *
reinterpret_cast<uint16*
>(&dataTable[offset]) = 0;
499 ABORT_MSG(
"Unknown format character '%c' found in %s meta for parent field %s",
519 std::array<char const*, TOTAL_LOCALES> detectedLocales;
520 auto itr = detectedLocales.begin();
553 if (indexVal >= indexTableSize)
556 char* recordData = indexTable[indexVal];
589 reinterpret_cast<LocalizedString*
>(&recordData[offset])->Str[locale] = stringPool + (
string -
reinterpret_cast<char const*
>(
_stringTable));
595 *
reinterpret_cast<char**
>(&recordData[offset]) = stringPool + (
string -
reinterpret_cast<char const*
>(
_stringTable));
597 offset +=
sizeof(
char*);
600 ABORT_MSG(
"Unknown format character '%c' found in %s meta for field %s",
622 for (
uint32 c = 0; c < recordCopies; ++c)
627 indexTable[copy.
NewRowId] = &dataTable[offset];
629 *
reinterpret_cast<uint32*
>(&dataTable[offset + idFieldOffset]) = copy.
NewRowId;
630 offset += recordsize;
639 uint32 recordIndexOffset = 0;
645 for (std::size_t j = 0; j <
_parentIndexes[i][0].Entries.size(); ++j)
649 char* recordData = &dataTable[recordIndex * recordSize];
658 *
reinterpret_cast<uint32*
>(&recordData[parentIdOffset]) = parentId;
663 ASSERT(parentId <= std::numeric_limits<uint16>::max(),
"ParentId value %u does not fit into uint16 field (%s in %s)",
665 *
reinterpret_cast<uint16*
>(&recordData[parentIdOffset]) = parentId;
674 *
reinterpret_cast<uint32*
>(&recordData[parentIdOffset]) = parentId;
679 ASSERT(parentId <= std::numeric_limits<uint8>::max(),
"ParentId value %u does not fit into uint8 field (%s in %s)",
681 *
reinterpret_cast<uint8*
>(&recordData[parentIdOffset]) = parentId;
686 *
reinterpret_cast<uint32*
>(&recordData[parentIdOffset]) = parentId;
700 return DB2Record(*
this, recordNumber,
nullptr);
755 return RecordGetVarInt<uint32>(record, indexField, 0);
757 return RecordGetVarInt<uint8>(record, indexField, 0);
759 return RecordGetVarInt<uint16>(record, indexField, 0);
770 return RecordGetVarInt<uint8>(record, field, arrayIndex);
775 return RecordGetVarInt<uint16>(record, field, arrayIndex);
780 return RecordGetVarInt<uint32>(record, field, arrayIndex);
785 return RecordGetVarInt<int32>(record, field, arrayIndex);
790 return RecordGetVarInt<uint64>(record, field, arrayIndex);
795 return RecordGetVarInt<float>(record, field, arrayIndex);
801 uint32 stringOffset = RecordGetVarInt<uint32>(record, field, arrayIndex);
803 return stringOffset ?
reinterpret_cast<char const*
>(record + fieldOffset + stringOffset) :
nullptr;
809 ASSERT(field < _header->FieldCount);
811 switch (compressionType)
815 T val = *
reinterpret_cast<T const*
>(record +
GetFieldOffset(field) +
sizeof(T) * arrayIndex);
823 _columnMeta[field].CompressionData.immediate.BitWidth,
_columnMeta[field].CompressionData.immediate.BitOffset);
826 memcpy(&value, &immediateValue, std::min(
sizeof(T),
sizeof(immediateValue)));
835 memcpy(&value, &valueItr->second, std::min(
sizeof(T),
sizeof(
uint32)));
837 memcpy(&value, &
_columnMeta[field].CompressionData.commonData.Value, std::min(
sizeof(T),
sizeof(
uint32)));
849 memcpy(&value, &palletValue, std::min(
sizeof(T),
sizeof(palletValue)));
860 memcpy(&value, &palletValue, std::min(
sizeof(T),
sizeof(palletValue)));
867 _columnMeta[field].CompressionData.immediate.BitWidth,
_columnMeta[field].CompressionData.immediate.BitOffset);
870 immediateValue = (immediateValue ^ mask) - mask;
872 memcpy(&value, &immediateValue, std::min(
sizeof(T),
sizeof(immediateValue)));
885 uint32 bitsToRead = bitOffset & 7;
886 return *
reinterpret_cast<uint64 const*
>(packedRecordData) << (64 - bitsToRead - bitWidth) >> (64 - bitWidth);
891 ASSERT(field < _header->FieldCount);
893 switch (compressionType)
929 uint32 minId = std::numeric_limits<uint32>::max();
948 if (minId == std::numeric_limits<uint32>::max())
976 ASSERT(maxId <= _header->MaxId);
997 _fieldAndArrayOffsets(loadInfo ? (
std::make_unique<
std::size_t[]>(loadInfo->Meta->FieldCount + loadInfo->FieldCount - (!loadInfo->Meta->HasIndexFieldInData() ? 1 : 0))) : nullptr)
1005 std::unique_ptr<std::unordered_map<uint32, uint32>[]> )
1021 std::size_t oldSize =
_catalog.size();
1028 std::size_t oldCopyTableSize =
_copyTable.size();
1062 using index_entry_t =
char*;
1065 indexTable =
new index_entry_t[indexTableSize];
1066 memset(indexTable, 0, indexTableSize *
sizeof(index_entry_t));
1068 char* dataTable =
new char[(records +
_copyTable.size()) * recordsize];
1069 memset(dataTable, 0, (records +
_copyTable.size()) * recordsize);
1091 indexTable[indexVal] = &dataTable[offset];
1096 *
reinterpret_cast<uint32*
>(&dataTable[offset]) = indexVal;
1108 *
reinterpret_cast<float*
>(&dataTable[offset]) =
RecordGetFloat(rawRecord, x, z);
1128 for (
char const*& localeStr :
reinterpret_cast<LocalizedString*
>(&dataTable[offset])->Str)
1134 *
reinterpret_cast<char const**
>(&dataTable[offset]) =
EmptyDb2String;
1135 offset +=
sizeof(
char*);
1138 ABORT_MSG(
"Unknown format character '%c' found in %s meta for field %s",
1153 *
reinterpret_cast<uint32*
>(&dataTable[offset]) = 0;
1157 *
reinterpret_cast<uint8*
>(&dataTable[offset]) = 0;
1161 *
reinterpret_cast<uint16*
>(&dataTable[offset]) = 0;
1165 ABORT_MSG(
"Unknown format character '%c' found in %s meta for parent field %s",
1185 std::array<char const*, TOTAL_LOCALES> detectedLocales;
1186 auto itr = detectedLocales.begin();
1203 std::size_t stringsInRecordSize = (stringFields - localizedStringFields) *
sizeof(
char*);
1204 std::size_t localizedStringsInRecordSize = localizedStringFields *
sizeof(
LocalizedString);
1209 char* stringTable =
new char[stringTableSize];
1210 memset(stringTable, 0, stringTableSize);
1211 char* stringPtr = stringTable;
1231 if (indexVal >= indexTableSize)
1234 char* recordData = indexTable[indexVal];
1268 db2str->
Str[locale] = stringPtr;
1270 stringPtr += strlen(stringPtr) + 1;
1276 char const** db2str =
reinterpret_cast<char const**
>(&recordData[offset]);
1277 *db2str = stringPtr;
1279 stringPtr += strlen(stringPtr) + 1;
1280 offset +=
sizeof(
char*);
1284 ABORT_MSG(
"Unknown format character '%c' found in %s meta for field %s",
1306 for (
uint32 c = 0; c < recordCopies; ++c)
1311 indexTable[copy.
NewRowId] = &dataTable[offset];
1313 *
reinterpret_cast<uint32*
>(&dataTable[offset + idFieldOffset]) = copy.
NewRowId;
1314 offset += recordsize;
1346 uint32 recordIndexOffset = 0;
1352 for (std::size_t j = 0; j <
_parentIndexes[i][0].Entries.size(); ++j)
1355 char* recordData = &dataTable[(
_parentIndexes[i][0].Entries[j].RecordIndex + recordIndexOffset) * recordSize];
1364 *
reinterpret_cast<uint32*
>(&recordData[parentIdOffset]) = parentId;
1369 ASSERT(parentId <= 0xFFFF,
"ParentId value %u does not fit into uint16 field (%s in %s)",
1371 *
reinterpret_cast<uint16*
>(&recordData[parentIdOffset]) = parentId;
1380 *
reinterpret_cast<uint32*
>(&recordData[parentIdOffset]) = parentId;
1385 ASSERT(parentId <= 0xFF,
"ParentId value %u does not fit into uint8 field (%s in %s)",
1387 *
reinterpret_cast<uint8*
>(&recordData[parentIdOffset]) = parentId;
1392 *
reinterpret_cast<uint32*
>(&recordData[parentIdOffset]) = parentId;
1421 if (recordNumber >=
_catalog.size())
1446 ASSERT(field < _header->FieldCount);
1452 ASSERT(field < _header->FieldCount);
1470 ASSERT(field < _header->FieldCount);
1478 ASSERT(field < _header->FieldCount);
1479 float val = *
reinterpret_cast<float const*
>(record +
GetFieldOffset(field, arrayIndex));
1486 ASSERT(field < _header->FieldCount);
1487 return reinterpret_cast<char const*
>(record +
GetFieldOffset(field, arrayIndex));
1492 ASSERT(field < _header->FieldCount);
1499 return val <<
_fields[field].UnusedBits >>
_fields[field].UnusedBits;
1509 ASSERT(field < _header->FieldCount);
1510 return 4 -
_fields[field].UnusedBits / 8;
1519 std::size_t* newOffsets =
new std::size_t[size];
1530 std::size_t* newOffsets =
new std::size_t[size];
1540 delete[] fieldOffsets;
1541 fieldOffsets =
nullptr;
1546 std::size_t offset = 0;
1563 offset +=
sizeof(float);
1567 offset += strlen(
reinterpret_cast<char const*
>(rawRecord) + offset) + 1;
1599 : _db2(db2), _recordIndex(recordIndex), _recordData(db2.GetRawRecordData(recordIndex, nullptr)), _fieldOffsets(fieldOffsets)
1604 : _db2(other._db2), _recordIndex(other._recordIndex), _recordData(other._recordData), _fieldOffsets(_db2.RecordCopyDetachedFieldOffsets(other._fieldOffsets))
1609 : _db2(other._db2), _recordIndex(other._recordIndex), _recordData(other._recordData), _fieldOffsets(std::exchange(other._fieldOffsets,
nullptr))
1618DB2Record::operator bool()
const
1620 return _recordData !=
nullptr;
1636 ASSERT(fieldIndex.first != -1,
"Field with name %s does not exist!", fieldName);
1648 ASSERT(fieldIndex.first != -1,
"Field with name %s does not exist!", fieldName);
1660 ASSERT(fieldIndex.first != -1,
"Field with name %s does not exist!", fieldName);
1672 ASSERT(fieldIndex.first != -1,
"Field with name %s does not exist!", fieldName);
1684 ASSERT(fieldIndex.first != -1,
"Field with name %s does not exist!", fieldName);
1696 ASSERT(fieldIndex.first != -1,
"Field with name %s does not exist!", fieldName);
1708 ASSERT(fieldIndex.first != -1,
"Field with name %s does not exist!", fieldName);
1729 throw std::system_error(std::make_error_code(std::errc::no_such_file_or_directory));
1778 std::unique_ptr<DB2SectionHeader[]> sections = std::make_unique<DB2SectionHeader[]>(
_header.
SectionCount);
1782 std::unique_ptr<DB2FieldEntry[]> fieldData = std::make_unique<DB2FieldEntry[]>(
_header.
FieldCount);
1786 std::unique_ptr<DB2ColumnMeta[]> columnMeta;
1787 std::unique_ptr<std::unique_ptr<DB2PalletValue[]>[]> palletValues;
1788 std::unique_ptr<std::unique_ptr<DB2PalletValue[]>[]> palletArrayValues;
1789 std::unique_ptr<std::unordered_map<uint32, uint32>[]> commonValues;
1811 palletValues[i] = std::make_unique<DB2PalletValue[]>(columnMeta[i].AdditionalDataSize /
sizeof(
DB2PalletValue));
1812 if (!source->
Read(palletValues[i].get(), columnMeta[i].AdditionalDataSize))
1822 palletArrayValues[i] = std::make_unique<DB2PalletValue[]>(columnMeta[i].AdditionalDataSize /
sizeof(
DB2PalletValue));
1823 if (!source->
Read(palletArrayValues[i].get(), columnMeta[i].AdditionalDataSize))
1827 std::unique_ptr<std::unique_ptr<DB2CommonValue[]>[]> commonData = std::make_unique<std::unique_ptr<DB2CommonValue[]>[]>(
_header.
TotalFieldCount);
1834 if (!columnMeta[i].AdditionalDataSize)
1837 commonData[i] = std::make_unique<DB2CommonValue[]>(columnMeta[i].AdditionalDataSize /
sizeof(
DB2CommonValue));
1838 if (!source->
Read(commonData[i].get(), columnMeta[i].AdditionalDataSize))
1842 for (
uint32 record = 0; record < numExtraValuesForField; ++record)
1844 uint32 recordId = commonData[i][record].RecordId;
1845 uint32 value = commonData[i][record].Value;
1847 commonValues[i][recordId] = value;
1857 _impl->
LoadColumnData(std::move(sections), std::move(fieldData), std::move(columnMeta), std::move(palletValues), std::move(palletArrayValues), std::move(commonValues));
1864 std::vector<uint32> idTable;
1865 std::vector<DB2RecordCopy> copyTable;
1866 std::vector<std::vector<DB2IndexData>> parentIndexes;
1873 for (std::vector<DB2IndexData>& parentIndexesForSection : parentIndexes)
1884 if (!source->
Read(&encryptedIdCount,
sizeof(encryptedIdCount)))
1894 uint32 totalCopyTableSize = 0;
1895 uint32 totalParentLookupDataSize = 0;
1903 int64 expectedFileSize =
1908 totalCopyTableSize +
1909 totalParentLookupDataSize;
1958 std::size_t idTableSize = idTable.size();
1964 for (std::size_t i = idTableSize; i < idTable.size(); ++i)
1971 std::size_t copyTableSize = copyTable.size();
1979 std::vector<DB2IndexData>& parentIndexesForSection = parentIndexes[i];
1989 parentIndexesForSection[j].Entries.resize(indexInfo.
NumEntries);
2001 std::vector<std::string> signValidationResult;
2016 signValidationResult.back() +=
" (IndexField must always be unsigned)";
2018 signValidationResult.back() +=
" (ParentIndexField must always be unsigned)";
2023 if (!signValidationResult.empty())
void EndianConvert(T &val)
char const * localeNames[TOTAL_LOCALES]
static bool IsKnownTactId(uint64 tactId)
static char const *const EmptyDb2String
constinit uint64 DUMMY_KNOWN_TACT_ID
@ FT_STRING_NOT_LOCALIZED
virtual char * AutoProduceData(uint32 &indexTableSize, char **&indexTable)=0
virtual uint64 RecordGetUInt64(uint8 const *record, uint32 field, uint32 arrayIndex) const =0
virtual uint32 GetMaxId() const =0
virtual uint32 GetRecordCopyCount() const =0
virtual DB2SectionHeader & GetSection(uint32 section) const =0
DB2FileLoaderImpl()=default
virtual ~DB2FileLoaderImpl()=default
virtual DB2FileLoadInfo const * GetLoadInfo() const =0
virtual uint32 RecordGetId(uint8 const *record, uint32 recordIndex) const =0
virtual float RecordGetFloat(uint8 const *record, uint32 field, uint32 arrayIndex) const =0
virtual void SetAdditionalData(std::vector< uint32 > idTable, std::vector< DB2RecordCopy > copyTable, std::vector< std::vector< DB2IndexData > > parentIndexes)=0
virtual void LoadColumnData(std::unique_ptr< DB2SectionHeader[]> sections, std::unique_ptr< DB2FieldEntry[]> fields, std::unique_ptr< DB2ColumnMeta[]> columnMeta, std::unique_ptr< std::unique_ptr< DB2PalletValue[]>[]> palletValues, std::unique_ptr< std::unique_ptr< DB2PalletValue[]>[]> palletArrayValues, std::unique_ptr< std::unordered_map< uint32, uint32 >[]> commonValues)=0
virtual std::size_t * RecordCopyDetachedFieldOffsets(std::size_t *oldOffsets) const =0
virtual std::size_t * RecordCreateDetachedFieldOffsets(std::size_t *oldOffsets) const =0
virtual uint32 GetMinId() const =0
virtual DB2Record GetRecord(uint32 recordNumber) const =0
virtual DB2RecordCopy GetRecordCopy(uint32 copyNumber) const =0
virtual uint32 RecordGetUInt32(uint8 const *record, uint32 field, uint32 arrayIndex) const =0
virtual char const * RecordGetString(uint8 const *record, uint32 field, uint32 arrayIndex) const =0
DB2FileLoaderImpl(DB2FileLoaderImpl const &other)=delete
virtual bool LoadCatalogData(DB2FileSource *source, uint32 section)=0
virtual bool LoadTableData(DB2FileSource *source, uint32 section)=0
DB2FileLoaderImpl(DB2FileLoaderImpl &&other) noexcept=delete
virtual void AutoProduceRecordCopies(uint32 records, char **indexTable, char *dataTable)=0
virtual void SkipEncryptedSection(uint32 section)=0
virtual int32 RecordGetInt32(uint8 const *record, uint32 field, uint32 arrayIndex) const =0
virtual uint32 GetRecordCount() const =0
virtual uint8 RecordGetUInt8(uint8 const *record, uint32 field, uint32 arrayIndex) const =0
virtual unsigned char const * GetRawRecordData(uint32 recordNumber, uint32 const *section) const =0
virtual void RecordDestroyFieldOffsets(std::size_t *&fieldOffsets) const =0
virtual char * AutoProduceStrings(char **indexTable, uint32 indexTableSize, uint32 locale)=0
virtual uint16 RecordGetUInt16(uint8 const *record, uint32 field, uint32 arrayIndex) const =0
DB2FileLoaderImpl & operator=(DB2FileLoaderImpl const &other)=delete
DB2FileLoaderImpl & operator=(DB2FileLoaderImpl &&other) noexcept=delete
std::unique_ptr< DB2ColumnMeta[]> _columnMeta
void FillParentLookup(char *dataTable)
char * AutoProduceData(uint32 &indexTableSize, char **&indexTable) override
DB2FileLoadInfo const * _loadInfo
uint64 RecordGetPackedValue(uint8 const *packedRecordData, uint32 bitWidth, uint32 bitOffset) const
DB2FileLoaderRegularImpl(char const *fileName, DB2FileLoadInfo const *loadInfo, DB2Header const *header)
DB2FileLoaderRegularImpl & operator=(DB2FileLoaderRegularImpl &&other) noexcept=delete
DB2Header const * _header
uint32 GetRecordSection(uint32 recordNumber) const
DB2SectionHeader & GetSection(uint32 section) const override
std::size_t * RecordCreateDetachedFieldOffsets(std::size_t *oldOffsets) const override
bool LoadCatalogData(DB2FileSource *, uint32) override
std::unique_ptr< std::unique_ptr< DB2PalletValue[]>[]> _palletArrayValues
uint32 GetMaxId() const override
uint8 RecordGetUInt8(uint8 const *record, uint32 field, uint32 arrayIndex) const override
unsigned char const * GetRawRecordData(uint32 recordNumber, uint32 const *section) const override
uint32 GetRecordCopyCount() const override
std::unique_ptr< DB2SectionHeader[]> _sections
uint32 RecordGetUInt32(uint8 const *record, uint32 field, uint32 arrayIndex) const override
float RecordGetFloat(uint8 const *record, uint32 field, uint32 arrayIndex) const override
void SkipEncryptedSection(uint32) override
void SetAdditionalData(std::vector< uint32 > idTable, std::vector< DB2RecordCopy > copyTable, std::vector< std::vector< DB2IndexData > > parentIndexes) override
void LoadColumnData(std::unique_ptr< DB2SectionHeader[]> sections, std::unique_ptr< DB2FieldEntry[]> fields, std::unique_ptr< DB2ColumnMeta[]> columnMeta, std::unique_ptr< std::unique_ptr< DB2PalletValue[]>[]> palletValues, std::unique_ptr< std::unique_ptr< DB2PalletValue[]>[]> palletArrayValues, std::unique_ptr< std::unordered_map< uint32, uint32 >[]> commonValues) override
char const * RecordGetString(uint8 const *record, uint32 field, uint32 arrayIndex) const override
void RecordDestroyFieldOffsets(std::size_t *&fieldOffsets) const override
std::vector< DB2RecordCopy > _copyTable
std::unique_ptr< std::unique_ptr< DB2PalletValue[]>[]> _palletValues
DB2Record GetRecord(uint32 recordNumber) const override
std::unique_ptr< uint8[]> _data
DB2RecordCopy GetRecordCopy(uint32 copyNumber) const override
DB2FileLoaderRegularImpl & operator=(DB2FileLoaderRegularImpl const &other)=delete
DB2FileLoadInfo const * GetLoadInfo() const override
~DB2FileLoaderRegularImpl()
uint32 RecordGetId(uint8 const *record, uint32 recordIndex) const override
char * AutoProduceStrings(char **indexTable, uint32 indexTableSize, uint32 locale) override
uint16 GetFieldOffset(uint32 field) const
uint64 RecordGetUInt64(uint8 const *record, uint32 field, uint32 arrayIndex) const override
DB2FileLoaderRegularImpl(DB2FileLoaderRegularImpl const &other)=delete
std::vector< std::vector< DB2IndexData > > _parentIndexes
uint32 GetRecordCount() const override
void AutoProduceRecordCopies(uint32 records, char **indexTable, char *dataTable) override
std::size_t * RecordCopyDetachedFieldOffsets(std::size_t *oldOffsets) const override
DB2FileLoaderRegularImpl(DB2FileLoaderRegularImpl &&other) noexcept=delete
int32 RecordGetInt32(uint8 const *record, uint32 field, uint32 arrayIndex) const override
std::vector< uint32 > _idTable
std::unique_ptr< std::unordered_map< uint32, uint32 >[]> _commonValues
uint16 RecordGetUInt16(uint8 const *record, uint32 field, uint32 arrayIndex) const override
bool LoadTableData(DB2FileSource *source, uint32 section) override
uint32 GetMinId() const override
T RecordGetVarInt(uint8 const *record, uint32 field, uint32 arrayIndex) const
std::unique_ptr< uint8[]> _recordBuffer
DB2FileSource *const _source
void FillParentLookup(char *dataTable)
void CalculateAndStoreFieldOffsets(uint8 const *rawRecord) const
DB2FileLoaderSparseImpl(DB2FileLoaderSparseImpl const &other)=delete
bool LoadTableData(DB2FileSource *, uint32) override
void RecordDestroyFieldOffsets(std::size_t *&fieldOffsets) const override
DB2FileLoadInfo const * _loadInfo
std::vector< DB2RecordCopy > _copyTable
DB2SectionHeader & GetSection(uint32 section) const override
uint32 GetRecordSection(uint32 recordNumber) const
uint32 GetMinId() const override
std::vector< std::vector< DB2IndexData > > _parentIndexes
uint32 GetMaxId() const override
std::unique_ptr< DB2FieldEntry[]> _fields
unsigned char const * GetRawRecordData(uint32 recordNumber, uint32 const *section) const override
DB2Record GetRecord(uint32 recordNumber) const override
uint32 GetRecordCopyCount() const override
char * AutoProduceData(uint32 &indexTableSize, char **&indexTable) override
char const * RecordGetString(uint8 const *record, uint32 field, uint32 arrayIndex) const override
DB2FileLoaderSparseImpl(char const *fileName, DB2FileLoadInfo const *loadInfo, DB2Header const *header, DB2FileSource *source)
void SkipEncryptedSection(uint32 section) override
uint32 RecordGetVarInt(uint8 const *record, uint32 field, uint32 arrayIndex, bool isSigned) const
DB2RecordCopy GetRecordCopy(uint32 copyNumber) const override
float RecordGetFloat(uint8 const *record, uint32 field, uint32 arrayIndex) const override
uint64 RecordGetUInt64(uint8 const *record, uint32 field, uint32 arrayIndex) const override
bool LoadCatalogData(DB2FileSource *source, uint32 section) override
DB2FileLoaderSparseImpl(DB2FileLoaderSparseImpl &&other) noexcept=delete
uint32 RecordGetId(uint8 const *record, uint32 recordIndex) const override
uint32 RecordGetUInt32(uint8 const *record, uint32 field, uint32 arrayIndex) const override
DB2Header const * _header
DB2FileLoadInfo const * GetLoadInfo() const override
DB2FileLoaderSparseImpl & operator=(DB2FileLoaderSparseImpl const &other)=delete
std::unique_ptr< DB2SectionHeader[]> _sections
std::size_t * RecordCopyDetachedFieldOffsets(std::size_t *oldOffsets) const override
std::size_t _totalRecordSize
DB2FileLoaderSparseImpl & operator=(DB2FileLoaderSparseImpl &&other) noexcept=delete
std::unique_ptr< std::size_t[]> _fieldAndArrayOffsets
void SetAdditionalData(std::vector< uint32 > idTable, std::vector< DB2RecordCopy > copyTable, std::vector< std::vector< DB2IndexData > > parentIndexes) override
std::vector< DB2CatalogEntry > _catalog
std::vector< uint32 > _catalogIds
uint16 GetFieldOffset(uint32 field, uint32 arrayIndex) const
uint8 RecordGetUInt8(uint8 const *record, uint32 field, uint32 arrayIndex) const override
int32 RecordGetInt32(uint8 const *record, uint32 field, uint32 arrayIndex) const override
~DB2FileLoaderSparseImpl()
std::size_t * RecordCreateDetachedFieldOffsets(std::size_t *oldOffsets) const override
void LoadColumnData(std::unique_ptr< DB2SectionHeader[]> sections, std::unique_ptr< DB2FieldEntry[]> fields, std::unique_ptr< DB2ColumnMeta[]> columnMeta, std::unique_ptr< std::unique_ptr< DB2PalletValue[]>[]> palletValues, std::unique_ptr< std::unique_ptr< DB2PalletValue[]>[]> palletArrayValues, std::unique_ptr< std::unordered_map< uint32, uint32 >[]> commonValues) override
uint16 GetFieldSize(uint32 field) const
uint32 GetRecordCount() const override
uint16 RecordGetUInt16(uint8 const *record, uint32 field, uint32 arrayIndex) const override
char * AutoProduceStrings(char **indexTable, uint32 indexTableSize, uint32 locale) override
void AutoProduceRecordCopies(uint32 records, char **indexTable, char *dataTable) override
void Load(DB2FileSource *source, DB2FileLoadInfo const *loadInfo)
DB2Record GetRecord(uint32 recordNumber) const
DB2RecordCopy GetRecordCopy(uint32 copyNumber) const
char * AutoProduceData(uint32 &indexTableSize, char **&indexTable)
char * AutoProduceStrings(char **indexTable, uint32 indexTableSize, LocaleConstant locale)
void LoadHeaders(DB2FileSource *source, DB2FileLoadInfo const *loadInfo)
DB2SectionHeader const & GetSectionHeader(uint32 section) const
uint32 GetRecordCopyCount() const
DB2FileLoaderImpl * _impl
void AutoProduceRecordCopies(uint32 records, char **indexTable, char *dataTable)
uint32 GetRecordCount() const
uint64 GetUInt64(uint32 field, uint32 arrayIndex) const
float GetFloat(uint32 field, uint32 arrayIndex) const
DB2Record(DB2FileLoaderImpl const &db2, uint32 recordIndex, std::size_t *fieldOffsets)
DB2FileLoaderImpl const & _db2
int32 GetInt32(uint32 field, uint32 arrayIndex) const
std::size_t * _fieldOffsets
uint32 GetUInt32(uint32 field, uint32 arrayIndex) const
uint16 GetUInt16(uint32 field, uint32 arrayIndex) const
uint8 GetUInt8(uint32 field, uint32 arrayIndex) const
char const * GetString(uint32 field, uint32 arrayIndex) const
unsigned char const * _recordData
std::string StringFormat(FormatString< Args... > fmt, Args &&... args) noexcept
Default TC string format function.
std::pair< int32, int32 > GetFieldIndexByName(char const *fieldName) const
uint32 GetStringFieldCount(bool localizedOnly) const
int32 GetFieldIndexByMetaIndex(uint32 metaIndex) const
DB2FieldMeta const * Fields
virtual int64 GetFileSize() const =0
virtual DB2EncryptedSectionHandling HandleEncryptedSection(DB2SectionHeader const §ionHeader) const =0
virtual char const * GetFileName() const =0
virtual bool IsOpen() const =0
virtual bool SetPosition(int64 position)=0
virtual bool Read(void *buffer, std::size_t numBytes)=0
virtual int64 GetPosition() const =0
std::vector< DB2IndexEntry > Entries
std::array< char const *, TOTAL_LOCALES > Str