25#include <system_error>
135 if (!strcmp(
Fields[ourIndex].
Name, fieldName))
142 return std::make_pair(-1, -1);
149 for (
uint32 i = 0; i < metaIndex; ++i)
168 std::unique_ptr<std::unique_ptr<
DB2PalletValue[]>[]> palletValues, std::unique_ptr<std::unique_ptr<
DB2PalletValue[]>[]> palletArrayValues,
169 std::unique_ptr<std::unordered_map<uint32, uint32>[]> commonValues) = 0;
173 virtual void SetAdditionalData(std::vector<uint32> idTable, std::vector<DB2RecordCopy> copyTable, std::vector<std::vector<DB2IndexData>> parentIndexes) = 0;
215 std::unique_ptr<std::unique_ptr<
DB2PalletValue[]>[]> palletValues, std::unique_ptr<std::unique_ptr<
DB2PalletValue[]>[]> palletArrayValues,
216 std::unique_ptr<std::unordered_map<uint32, uint32>[]> commonValues)
override;
220 void SetAdditionalData(std::vector<uint32> idTable, std::vector<DB2RecordCopy> copyTable, std::vector<std::vector<DB2IndexData>> parentIndexes)
override;
281 std::unique_ptr<std::unique_ptr<
DB2PalletValue[]>[]> palletValues, std::unique_ptr<std::unique_ptr<
DB2PalletValue[]>[]> palletArrayValues,
282 std::unique_ptr<std::unordered_map<uint32, uint32>[]> commonValues)
override;
286 void SetAdditionalData(std::vector<uint32> idTable, std::vector<DB2RecordCopy> copyTable, std::vector<std::vector<DB2IndexData>> parentIndexes)
override;
341 _stringTable(nullptr)
346 std::unique_ptr<std::unique_ptr<
DB2PalletValue[]>[]> palletValues, std::unique_ptr<std::unique_ptr<
DB2PalletValue[]>[]> palletArrayValues,
347 std::unique_ptr<std::unordered_map<uint32, uint32>[]> commonValues)
364 uint32 sectionDataStart = 0;
365 uint32 sectionStringTableStart = 0;
366 for (
uint32 i = 0; i < section; ++i)
369 sectionStringTableStart +=
_sections[i].StringTableSize;
399 using index_entry_t =
char*;
401 indexTableSize = maxi;
402 indexTable =
new index_entry_t[maxi];
403 memset(indexTable, 0, maxi *
sizeof(index_entry_t));
428 indexTable[indexVal] = &dataTable[offset];
433 *
reinterpret_cast<uint32*
>(&dataTable[offset]) = indexVal;
445 *
reinterpret_cast<float*
>(&dataTable[offset]) =
RecordGetFloat(rawRecord, x, z);
449 *
reinterpret_cast<uint32*
>(&dataTable[offset]) = RecordGetVarInt<uint32>(rawRecord, x, z);
465 for (
char const*& localeStr :
reinterpret_cast<LocalizedString*
>(&dataTable[offset])->
Str)
471 *
reinterpret_cast<char const**
>(&dataTable[offset]) =
EmptyDb2String;
472 offset +=
sizeof(
char*);
475 ABORT_MSG(
"Unknown format character '%c' found in %s meta for field %s",
490 *
reinterpret_cast<uint32*
>(&dataTable[offset]) = 0;
494 *
reinterpret_cast<uint8*
>(&dataTable[offset]) = 0;
498 *
reinterpret_cast<uint16*
>(&dataTable[offset]) = 0;
502 ABORT_MSG(
"Unknown format character '%c' found in %s meta for parent field %s",
522 char const* sep =
"";
523 std::ostringstream str;
533 TC_LOG_ERROR(
"",
"Attempted to load {} which has locales {} as {}. Check if you placed your localized db2 files in correct directory.",
_fileName, str.str(),
localeNames[locale]);
561 if (indexVal >= indexTableSize)
564 char* recordData = indexTable[indexVal];
597 reinterpret_cast<LocalizedString*
>(&recordData[offset])->Str[locale] = stringPool + (
string -
reinterpret_cast<char const*
>(
_stringTable));
603 *
reinterpret_cast<char**
>(&recordData[offset]) = stringPool + (
string -
reinterpret_cast<char const*
>(
_stringTable));
605 offset +=
sizeof(
char*);
608 ABORT_MSG(
"Unknown format character '%c' found in %s meta for field %s",
630 for (
uint32 c = 0; c < recordCopies; ++c)
635 indexTable[copy.
NewRowId] = &dataTable[offset];
637 *
reinterpret_cast<uint32*
>(&dataTable[offset + idFieldOffset]) = copy.
NewRowId;
638 offset += recordsize;
647 uint32 recordIndexOffset = 0;
653 for (std::size_t j = 0; j <
_parentIndexes[i][0].Entries.size(); ++j)
657 char* recordData = &dataTable[recordIndex * recordSize];
666 *
reinterpret_cast<uint32*
>(&recordData[parentIdOffset]) = parentId;
671 ASSERT(parentId <= std::numeric_limits<uint16>::max(),
"ParentId value %u does not fit into uint16 field (%s in %s)",
673 *
reinterpret_cast<uint16*
>(&recordData[parentIdOffset]) = parentId;
682 *
reinterpret_cast<uint32*
>(&recordData[parentIdOffset]) = parentId;
687 ASSERT(parentId <= std::numeric_limits<uint8>::max(),
"ParentId value %u does not fit into uint8 field (%s in %s)",
689 *
reinterpret_cast<uint8*
>(&recordData[parentIdOffset]) = parentId;
694 *
reinterpret_cast<uint32*
>(&recordData[parentIdOffset]) = parentId;
708 return DB2Record(*
this, recordNumber,
nullptr);
765 return RecordGetVarInt<uint8>(record, field, arrayIndex);
770 return RecordGetVarInt<uint16>(record, field, arrayIndex);
775 return RecordGetVarInt<uint32>(record, field, arrayIndex);
780 return RecordGetVarInt<int32>(record, field, arrayIndex);
785 return RecordGetVarInt<uint64>(record, field, arrayIndex);
790 return RecordGetVarInt<float>(record, field, arrayIndex);
796 uint32 stringOffset = RecordGetVarInt<uint32>(record, field, arrayIndex);
798 return stringOffset ?
reinterpret_cast<char const*
>(record + fieldOffset + stringOffset) :
nullptr;
804 ASSERT(field < _header->FieldCount);
806 switch (compressionType)
810 T val = *
reinterpret_cast<T const*
>(record +
GetFieldOffset(field) +
sizeof(T) * arrayIndex);
818 _columnMeta[field].CompressionData.immediate.BitWidth,
_columnMeta[field].CompressionData.immediate.BitOffset);
821 memcpy(&value, &immediateValue, std::min(
sizeof(T),
sizeof(immediateValue)));
830 memcpy(&value, &valueItr->second, std::min(
sizeof(T),
sizeof(
uint32)));
832 memcpy(&value, &
_columnMeta[field].CompressionData.commonData.Value, std::min(
sizeof(T),
sizeof(
uint32)));
844 memcpy(&value, &palletValue, std::min(
sizeof(T),
sizeof(palletValue)));
855 memcpy(&value, &palletValue, std::min(
sizeof(T),
sizeof(palletValue)));
862 _columnMeta[field].CompressionData.immediate.BitWidth,
_columnMeta[field].CompressionData.immediate.BitOffset);
865 immediateValue = (immediateValue ^ mask) - mask;
867 memcpy(&value, &immediateValue, std::min(
sizeof(T),
sizeof(immediateValue)));
880 uint32 bitsToRead = bitOffset & 7;
881 return *
reinterpret_cast<uint64 const*
>(packedRecordData) << (64 - bitsToRead - bitWidth) >> (64 - bitWidth);
886 ASSERT(field < _header->FieldCount);
888 switch (compressionType)
924 uint32 minId = std::numeric_limits<uint32>::max();
943 if (minId == std::numeric_limits<uint32>::max())
971 ASSERT(maxId <= _header->MaxId);
995 switch (compressionType)
1020 return " (ParentIndexField must always be unsigned)";
1024 switch (compressionType)
1031 return " (IndexField must always be unsigned)";
1033 return " (ParentIndexField must always be unsigned)";
1036 return " (CompressionType is SignedImmediate)";
1038 return " (CompressionType is Immediate)";
1048 _fileName(fileName),
1049 _loadInfo(loadInfo),
1052 _totalRecordSize(0),
1054 _fieldAndArrayOffsets(loadInfo ? (
std::make_unique<
std::size_t[]>(loadInfo->Meta->FieldCount + loadInfo->FieldCount - (!loadInfo->Meta->HasIndexFieldInData() ? 1 : 0))) : nullptr)
1062 std::unique_ptr<std::unordered_map<uint32, uint32>[]> )
1078 std::size_t oldSize =
_catalog.size();
1085 std::size_t oldCopyTableSize =
_copyTable.size();
1119 using index_entry_t =
char*;
1122 indexTable =
new index_entry_t[indexTableSize];
1123 memset(indexTable, 0, indexTableSize *
sizeof(index_entry_t));
1125 char* dataTable =
new char[(records +
_copyTable.size()) * recordsize];
1126 memset(dataTable, 0, (records +
_copyTable.size()) * recordsize);
1148 indexTable[indexVal] = &dataTable[offset];
1153 *
reinterpret_cast<uint32*
>(&dataTable[offset]) = indexVal;
1165 *
reinterpret_cast<float*
>(&dataTable[offset]) =
RecordGetFloat(rawRecord, x, z);
1185 for (
char const*& localeStr :
reinterpret_cast<LocalizedString*
>(&dataTable[offset])->
Str)
1191 *
reinterpret_cast<char const**
>(&dataTable[offset]) =
EmptyDb2String;
1192 offset +=
sizeof(
char*);
1195 ABORT_MSG(
"Unknown format character '%c' found in %s meta for field %s",
1210 *
reinterpret_cast<uint32*
>(&dataTable[offset]) = 0;
1214 *
reinterpret_cast<uint8*
>(&dataTable[offset]) = 0;
1218 *
reinterpret_cast<uint16*
>(&dataTable[offset]) = 0;
1222 ABORT_MSG(
"Unknown format character '%c' found in %s meta for parent field %s",
1242 char const* sep =
"";
1243 std::ostringstream str;
1253 TC_LOG_ERROR(
"",
"Attempted to load {} which has locales {} as {}. Check if you placed your localized db2 files in correct directory.",
_fileName, str.str(),
localeNames[locale]);
1265 std::size_t stringsInRecordSize = (stringFields - localizedStringFields) *
sizeof(
char*);
1266 std::size_t localizedStringsInRecordSize = localizedStringFields *
sizeof(
LocalizedString);
1271 char* stringTable =
new char[stringTableSize];
1272 memset(stringTable, 0, stringTableSize);
1273 char* stringPtr = stringTable;
1293 if (indexVal >= indexTableSize)
1296 char* recordData = indexTable[indexVal];
1330 db2str->
Str[locale] = stringPtr;
1332 stringPtr += strlen(stringPtr) + 1;
1338 char const** db2str =
reinterpret_cast<char const**
>(&recordData[offset]);
1339 *db2str = stringPtr;
1341 stringPtr += strlen(stringPtr) + 1;
1342 offset +=
sizeof(
char*);
1346 ABORT_MSG(
"Unknown format character '%c' found in %s meta for field %s",
1368 for (
uint32 c = 0; c < recordCopies; ++c)
1373 indexTable[copy.
NewRowId] = &dataTable[offset];
1375 *
reinterpret_cast<uint32*
>(&dataTable[offset + idFieldOffset]) = copy.
NewRowId;
1376 offset += recordsize;
1408 uint32 recordIndexOffset = 0;
1414 for (std::size_t j = 0; j <
_parentIndexes[i][0].Entries.size(); ++j)
1417 char* recordData = &dataTable[(
_parentIndexes[i][0].Entries[j].RecordIndex + recordIndexOffset) * recordSize];
1426 *
reinterpret_cast<uint32*
>(&recordData[parentIdOffset]) = parentId;
1431 ASSERT(parentId <= 0xFFFF,
"ParentId value %u does not fit into uint16 field (%s in %s)",
1433 *
reinterpret_cast<uint16*
>(&recordData[parentIdOffset]) = parentId;
1442 *
reinterpret_cast<uint32*
>(&recordData[parentIdOffset]) = parentId;
1447 ASSERT(parentId <= 0xFF,
"ParentId value %u does not fit into uint8 field (%s in %s)",
1449 *
reinterpret_cast<uint8*
>(&recordData[parentIdOffset]) = parentId;
1454 *
reinterpret_cast<uint32*
>(&recordData[parentIdOffset]) = parentId;
1483 if (recordNumber >=
_catalog.size())
1508 ASSERT(field < _header->FieldCount);
1514 ASSERT(field < _header->FieldCount);
1532 ASSERT(field < _header->FieldCount);
1540 ASSERT(field < _header->FieldCount);
1541 float val = *
reinterpret_cast<float const*
>(record +
GetFieldOffset(field, arrayIndex));
1548 ASSERT(field < _header->FieldCount);
1549 return reinterpret_cast<char const*
>(record +
GetFieldOffset(field, arrayIndex));
1554 ASSERT(field < _header->FieldCount);
1561 return val <<
_fields[field].UnusedBits >>
_fields[field].UnusedBits;
1571 ASSERT(field < _header->FieldCount);
1572 return 4 -
_fields[field].UnusedBits / 8;
1581 std::size_t* newOffsets =
new std::size_t[
size];
1592 std::size_t* newOffsets =
new std::size_t[
size];
1602 delete[] fieldOffsets;
1603 fieldOffsets =
nullptr;
1608 std::size_t offset = 0;
1625 offset +=
sizeof(float);
1629 offset += strlen(
reinterpret_cast<char const*
>(rawRecord) + offset) + 1;
1662 ASSERT(field < _header->FieldCount);
1668 ASSERT(field < _header->FieldCount);
1670 return " (IndexField must always be unsigned)";
1672 return " (ParentIndexField must always be unsigned)";
1677 : _db2(db2), _recordIndex(recordIndex), _recordData(db2.GetRawRecordData(recordIndex, nullptr)), _fieldOffsets(fieldOffsets)
1682 : _db2(other._db2), _recordIndex(other._recordIndex), _recordData(other._recordData), _fieldOffsets(_db2.RecordCopyDetachedFieldOffsets(other._fieldOffsets))
1687 : _db2(other._db2), _recordIndex(other._recordIndex), _recordData(other._recordData), _fieldOffsets(std::exchange(other._fieldOffsets,
nullptr))
1696DB2Record::operator bool()
const
1698 return _recordData !=
nullptr;
1714 ASSERT(fieldIndex.first != -1,
"Field with name %s does not exist!", fieldName);
1726 ASSERT(fieldIndex.first != -1,
"Field with name %s does not exist!", fieldName);
1738 ASSERT(fieldIndex.first != -1,
"Field with name %s does not exist!", fieldName);
1750 ASSERT(fieldIndex.first != -1,
"Field with name %s does not exist!", fieldName);
1762 ASSERT(fieldIndex.first != -1,
"Field with name %s does not exist!", fieldName);
1774 ASSERT(fieldIndex.first != -1,
"Field with name %s does not exist!", fieldName);
1786 ASSERT(fieldIndex.first != -1,
"Field with name %s does not exist!", fieldName);
1807 throw std::system_error(std::make_error_code(std::errc::no_such_file_or_directory));
1856 std::unique_ptr<DB2SectionHeader[]> sections = std::make_unique<DB2SectionHeader[]>(
_header.
SectionCount);
1860 std::unique_ptr<DB2FieldEntry[]> fieldData = std::make_unique<DB2FieldEntry[]>(
_header.
FieldCount);
1864 std::unique_ptr<DB2ColumnMeta[]> columnMeta;
1865 std::unique_ptr<std::unique_ptr<DB2PalletValue[]>[]> palletValues;
1866 std::unique_ptr<std::unique_ptr<DB2PalletValue[]>[]> palletArrayValues;
1867 std::unique_ptr<std::unordered_map<uint32, uint32>[]> commonValues;
1889 palletValues[i] = std::make_unique<DB2PalletValue[]>(columnMeta[i].AdditionalDataSize /
sizeof(
DB2PalletValue));
1890 if (!source->
Read(palletValues[i].get(), columnMeta[i].AdditionalDataSize))
1900 palletArrayValues[i] = std::make_unique<DB2PalletValue[]>(columnMeta[i].AdditionalDataSize /
sizeof(
DB2PalletValue));
1901 if (!source->
Read(palletArrayValues[i].get(), columnMeta[i].AdditionalDataSize))
1905 std::unique_ptr<std::unique_ptr<DB2CommonValue[]>[]> commonData = std::make_unique<std::unique_ptr<DB2CommonValue[]>[]>(
_header.
TotalFieldCount);
1912 if (!columnMeta[i].AdditionalDataSize)
1915 commonData[i] = std::make_unique<DB2CommonValue[]>(columnMeta[i].AdditionalDataSize /
sizeof(
DB2CommonValue));
1916 if (!source->
Read(commonData[i].get(), columnMeta[i].AdditionalDataSize))
1920 for (
uint32 record = 0; record < numExtraValuesForField; ++record)
1922 uint32 recordId = commonData[i][record].RecordId;
1923 uint32 value = commonData[i][record].Value;
1925 commonValues[i][recordId] = value;
1935 _impl->
LoadColumnData(std::move(sections), std::move(fieldData), std::move(columnMeta), std::move(palletValues), std::move(palletArrayValues), std::move(commonValues));
1942 std::vector<uint32> idTable;
1943 std::vector<DB2RecordCopy> copyTable;
1944 std::vector<std::vector<DB2IndexData>> parentIndexes;
1951 for (std::vector<DB2IndexData>& parentIndexesForSection : parentIndexes)
1962 if (!source->
Read(&encryptedIdCount,
sizeof(encryptedIdCount)))
1972 uint32 totalCopyTableSize = 0;
1973 uint32 totalParentLookupDataSize = 0;
1981 int64 expectedFileSize =
1986 totalCopyTableSize +
1987 totalParentLookupDataSize;
2036 std::size_t idTableSize = idTable.size();
2042 for (std::size_t i = idTableSize; i < idTable.size(); ++i)
2049 std::size_t copyTableSize = copyTable.size();
2057 std::vector<DB2IndexData>& parentIndexesForSection = parentIndexes[i];
2067 parentIndexesForSection[j].Entries.resize(indexInfo.
NumEntries);
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
#define TC_LOG_ERROR(filterType__,...)
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 bool IsSignedField(uint32 field) const =0
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 char const * GetExpectedSignMismatchReason(uint32 field) 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 * GetExpectedSignMismatchReason(uint32 field) const 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
bool IsSignedField(uint32 field) const 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
char const * GetExpectedSignMismatchReason(uint32 field) const override
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
bool IsSignedField(uint32 field) 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)
Default TC string format function.
constexpr std::size_t size()
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