small refactoring
This commit is contained in:
12
row.cpp
12
row.cpp
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user