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