Better assignment

This commit is contained in:
alesapin 2020-06-09 20:42:04 +03:00
parent d2fcf5aea5
commit 4c77ba664a
5 changed files with 15 additions and 0 deletions

View File

@ -36,6 +36,9 @@ IndexDescription::IndexDescription(const IndexDescription & other)
IndexDescription & IndexDescription::operator=(const IndexDescription & other)
{
if (&other == this)
return *this;
if (other.definition_ast)
definition_ast = other.definition_ast->clone();
else

View File

@ -22,6 +22,9 @@ KeyDescription::KeyDescription(const KeyDescription & other)
KeyDescription & KeyDescription::operator=(const KeyDescription & other)
{
if (&other == this)
return *this;
if (other.definition_ast)
definition_ast = other.definition_ast->clone();
else

View File

@ -24,6 +24,9 @@ SelectQueryDescription::SelectQueryDescription(const SelectQueryDescription & ot
SelectQueryDescription & SelectQueryDescription::SelectQueryDescription::operator=(const SelectQueryDescription & other)
{
if (&other == this)
return *this;
select_table_id = other.select_table_id;
if (other.select_query)
select_query = other.select_query->clone();

View File

@ -30,6 +30,9 @@ StorageInMemoryMetadata::StorageInMemoryMetadata(const StorageInMemoryMetadata &
StorageInMemoryMetadata & StorageInMemoryMetadata::operator=(const StorageInMemoryMetadata & other)
{
if (&other == this)
return *this;
columns = other.columns;
secondary_indices = other.secondary_indices;
constraints = other.constraints;

View File

@ -72,6 +72,9 @@ TTLDescription::TTLDescription(const TTLDescription & other)
TTLDescription & TTLDescription::operator=(const TTLDescription & other)
{
if (&other == this)
return *this;
mode = other.mode;
if (other.expression_ast)
expression_ast = other.expression_ast->clone();