fix move function
This commit is contained in:
parent
d293180eb1
commit
13396e0cab
@ -78,14 +78,26 @@ public:
|
|||||||
SqlConnection& operator=(const SqlConnection& other) = delete;
|
SqlConnection& operator=(const SqlConnection& other) = delete;
|
||||||
|
|
||||||
SqlConnection(SqlConnection&& other){
|
SqlConnection(SqlConnection&& other){
|
||||||
other.Close();
|
this->ip = std::move(other.ip);
|
||||||
this->Connect(other.ip, other.port, other.username, other.password, other.database_name);
|
this->port = std::move(other.port);
|
||||||
|
this->username = std::move(other.username);
|
||||||
|
this->password = std::move(other.password);
|
||||||
|
this->database_name = std::move(other.database_name);
|
||||||
|
this->mysql_client = other.mysql_client;
|
||||||
|
mysql_init(&(other.mysql_client));
|
||||||
}
|
}
|
||||||
|
|
||||||
SqlConnection& operator=(SqlConnection&& other){
|
SqlConnection& operator=(SqlConnection&& other){
|
||||||
if(this != &other){
|
if(this != &other){
|
||||||
this->Connect(other.ip, other.port, other.username, other.password, other.database_name);
|
this->Close();
|
||||||
other.Close();
|
this->ip = std::move(other.ip);
|
||||||
|
this->port = std::move(other.port);
|
||||||
|
this->username = std::move(other.username);
|
||||||
|
this->password = std::move(other.password);
|
||||||
|
this->database_name = std::move(other.database_name);
|
||||||
|
this->mysql_client = other.mysql_client;
|
||||||
|
mysql_init(&other.mysql_client);
|
||||||
|
|
||||||
}
|
}
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user