1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-08-08 14:22:09 +03:00

MCOL-3536 Use already existing Row:getStringPointer()

This commit is contained in:
David Hall
2019-10-09 09:04:10 -05:00
parent 78c96fc65b
commit 8f1cc7ad65
2 changed files with 4 additions and 15 deletions

View File

@@ -375,7 +375,6 @@ public:
inline std::string getStringField(uint32_t colIndex) const;
inline const uint8_t* getStringPointer(uint32_t colIndex) const;
inline uint32_t getStringLength(uint32_t colIndex) const;
inline const char* getCharPtrField(uint32_t colIndex, int& len) const;
void setStringField(const std::string& val, uint32_t colIndex);
inline void setStringField(const uint8_t*, uint32_t len, uint32_t colIndex);
@@ -775,17 +774,6 @@ inline std::string Row::getStringField(uint32_t colIndex) const
strnlen((char*) &data[offsets[colIndex]], getColumnWidth(colIndex)));
}
// Return a char* to the string field with len
inline const char* Row::getCharPtrField(uint32_t colIndex, int& len) const
{
len = getStringLength(colIndex);
if (inStringTable(colIndex))
{
return (const char*)strings->getPointer(*((uint64_t*) &data[offsets[colIndex]]));
}
return (char*)&data[offsets[colIndex]];
}
inline std::string Row::getVarBinaryStringField(uint32_t colIndex) const
{
if (inStringTable(colIndex))

View File

@@ -130,9 +130,10 @@ int StringCompare::operator()(IdbCompare* l, Row::Pointer r1, Row::Pointer r2)
}
else
{
int len1, len2;
const char* s1 = l->row1().getCharPtrField(fSpec.fIndex, len1);
const char* s2 = l->row2().getCharPtrField(fSpec.fIndex, len2);
int len1 = l->row1().getStringLength(fSpec.fIndex);
int len2 = l->row2().getStringLength(fSpec.fIndex);
const char* s1 = (const char*)l->row1().getStringPointer(fSpec.fIndex);
const char* s2 = (const char*)l->row2().getStringPointer(fSpec.fIndex);
const std::collate<char>& coll = std::use_facet<std::collate<char> >(loc);
ret = fSpec.fAsc * coll.compare(s1, s1+len1, s2, s2+len2);
}