48 uint32 indexTableSize = records;
50 if (
uint32((*maxIdResult)[0].GetUInt64()) > records)
51 indexTableSize =
uint32((*maxIdResult)[0].GetUInt64());
53 if (indexTableSize > records)
55 char** tmpIdxTable =
new char*[indexTableSize];
56 memset(tmpIdxTable, 0, indexTableSize *
sizeof(
char*));
57 memcpy(tmpIdxTable, indexTable, records *
sizeof(
char*));
59 indexTable = tmpIdxTable;
62 char* tempDataTable =
new char[result->GetRowCount() * recordSize];
63 memset(tempDataTable, 0, result->GetRowCount() * recordSize);
66 stringPool.reserve(std::max<uint64>(stringPool.capacity(), stringPool.size() + stringFields * result->GetRowCount() + 1));
72 Field* fields = result->Fetch();
79 char* dataValue = indexTable[indexValue];
82 newIndexes[newRecords] = indexValue;
83 dataValue = &tempDataTable[newRecords++ * recordSize];
90 *((
uint32*)(&dataValue[offset])) = indexValue;
102 *((
float*)(&dataValue[offset])) = fields[f].GetFloat();
106 *((
int32*)(&dataValue[offset])) = fields[f].GetInt32();
110 *((
int8*)(&dataValue[offset])) = fields[f].GetInt8();
114 *((
int16*)(&dataValue[offset])) = fields[f].GetInt16();
118 *((
int64*)(&dataValue[offset])) = fields[f].GetInt64();
125 for (
char const*& localeStr : slot->
Str)
130 stringPool.push_back(str);
137 char const** slot = (
char const**)(&dataValue[offset]);
140 if (
char* str =
AddString(slot, fields[f].GetString()))
141 stringPool.push_back(str);
145 offset +=
sizeof(
char*);
149 ABORT_MSG(
"Unknown format character '%c' found in %s meta for field %s",
157 ASSERT(offset == recordSize);
158 }
while (result->NextRow());
162 delete[] tempDataTable;
168 char* dataTable =
new char[newRecords * recordSize];
169 memcpy(dataTable, tempDataTable, newRecords * recordSize);
172 for (
uint32 i = 0; i < newRecords; ++i)
174 uint32 newId = newIndexes[i];
175 indexTable[newId] = &dataTable[i * recordSize];
176 minId = std::min(minId, newId);
179 delete[] tempDataTable;
182 records = indexTableSize;
197 if (result->GetFieldCount() != stringFields + 1 )
203 stringPool.reserve(std::max<uint64>(stringPool.capacity(), stringPool.size() + stringFields * result->GetRowCount() + 1));
207 Field* fields = result->Fetch();
209 uint32 stringFieldNumInRecord = 0;
212 if (indexValue >= records)
216 if (
char* dataValue = indexTable[indexValue])
225 for (
uint32 x = 0; x < fieldCount; ++x)
249 stringPool.push_back(str);
251 ++stringFieldNumInRecord;
256 offset +=
sizeof(
char*);
259 ABORT_MSG(
"Unknown format character '%c' found in %s meta for field %s",
267 ASSERT(offset == recordSize);
272 }
while (result->NextRow());
279 char* str =
new char[value.length() + 1];
280 memcpy(str, value.c_str(), value.length());
281 str[value.length()] =
'\0';
char const * localeNames[TOTAL_LOCALES]
static char const * nullStr
std::shared_ptr< PreparedResultSet > PreparedQueryResult
DatabaseWorkerPool< HotfixDatabaseConnection > HotfixDatabase
Accessor to the hotfix database.
@ FT_STRING_NOT_LOCALIZED
uint32 constexpr HOTFIX_MAX_ID_STMT_OFFSET
uint32 constexpr HOTFIX_LOCALE_STMT_OFFSET
#define TC_LOG_ERROR(filterType__,...)
char * Load(bool custom, uint32 &records, char **&indexTable, std::vector< char * > &stringPool, uint32 &minId)
DB2LoadInfo const * _loadInfo
void LoadStrings(bool custom, LocaleConstant locale, uint32 records, char **indexTable, std::vector< char * > &stringPool)
std::string const & _storageName
static char * AddString(char const **holder, std::string const &value)
Class used to access individual fields of database query result.
std::string GetString() const
void setBool(const uint8 index, const bool value)
void setString(const uint8 index, const std::string &value)
uint32 GetStringFieldCount(bool localizedOnly) const
DB2FieldMeta const * Fields
HotfixDatabaseStatements Statement
std::array< char const *, TOTAL_LOCALES > Str