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

Merge pull request #42 from mariadb-corporation/MCOL-352

MCOL-352 Fix VARCHAR with no NUL
This commit is contained in:
dhall-InfiniDB
2016-10-27 10:00:46 -05:00
committed by GitHub

View File

@@ -581,12 +581,9 @@ inline std::string Row::getStringField(uint32_t colIndex) const
if (inStringTable(colIndex))
return strings->getString(*((uint32_t *) &data[offsets[colIndex]]),
*((uint32_t *) &data[offsets[colIndex] + 4]));
if (types[colIndex] == execplan::CalpontSystemCatalog::VARCHAR)
return std::string((char *) &data[offsets[colIndex]]);
else // types where we can't rely on NULL termination...
return std::string((char *) &data[offsets[colIndex]],
strnlen((char *) &data[offsets[colIndex]], getColumnWidth(colIndex)));
// return std::string((char *) &data[offsets[colIndex]], getColumnWidth(colIndex));
// Not all CHAR/VARCHAR are NUL terminated so use length
return std::string((char *) &data[offsets[colIndex]],
strnlen((char *) &data[offsets[colIndex]], getColumnWidth(colIndex)));
}
inline std::string Row::getVarBinaryStringField(uint32_t colIndex) const