Only set connection history if strings differ

This commit is contained in:
Tim Wojtulewicz 2022-05-09 14:35:56 -07:00
parent 0aafc8ae6c
commit 1f8d406658
3 changed files with 12 additions and 2 deletions

View file

@ -273,8 +273,12 @@ const RecordValPtr& Connection::GetVal()
conn_val->AssignTime(3, start_time); // ###
conn_val->AssignInterval(4, last_time - start_time);
if ( history.size() )
if ( ! history.empty() )
{
auto v = conn_val->GetFieldAs<StringVal>(6);
if ( *v != history )
conn_val->Assign(6, history);
}
conn_val->SetOrigin(this);

View file

@ -115,6 +115,11 @@ bool String::operator==(std::string_view s) const
return (memcmp(b, s.data(), n) == 0);
}
bool String::operator!=(std::string_view s) const
{
return ! (*this == s);
}
void String::Adopt(byte_vec bytes, int len)
{
Reset();

View file

@ -56,6 +56,7 @@ public:
bool operator==(const String& bs) const;
bool operator<(const String& bs) const;
bool operator==(std::string_view s) const;
bool operator!=(std::string_view s) const;
byte_vec Bytes() const { return b; }
int Len() const { return n; }