diff --git a/include/sqlConnection.h b/include/sqlConnection.h index bb3798f..aa509d5 100644 --- a/include/sqlConnection.h +++ b/include/sqlConnection.h @@ -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; }