small refactoring

This commit is contained in:
2021-12-19 12:58:17 +01:00
parent 04c0ed3f03
commit 35cba3b0c4
8 changed files with 753 additions and 746 deletions

12
row.cpp
View File

@@ -29,6 +29,18 @@ int ColStringValue::compare(ColValue &other) const {
return other.isNull() ? 1 : m_string->compare(other.getStringValue()); // null goes to end
}
std::string ColStringValue::getCsvStringValue() const {
auto src_str = getStringValue();
std::string toSearch{"\""}, replaceStr{"\\\""};
size_t pos = src_str.find(toSearch);
while(pos != std::string::npos) {
src_str.replace(pos, toSearch.size(), replaceStr);
pos =src_str.find(toSearch, pos + replaceStr.size());
}
return src_str;
}
int ColDateValue::compare(ColValue &other) const {
long r = m_date - other.getIntegerValue();
return other.isNull() ? 1 : r > 0 ? 1 : r == 0 ? 0 : -1;