diff --git a/src/DAO/MySQLUserDAO.cpp b/src/DAO/MySQLUserDAO.cpp index 0ca9486..a94d4fd 100644 --- a/src/DAO/MySQLUserDAO.cpp +++ b/src/DAO/MySQLUserDAO.cpp @@ -25,9 +25,7 @@ string MySQLUserDAO::Create(const user& created_user) "INSERT INTO `up_and_down`.`users` (`uuid`, `login`, `hashed_password`) VALUES ('" + uuid_str + "', '" + created_user.login +"', '" + created_user.hashed_password + "');"s; - session_.sql(sql_script) - .bind(uuid_str, created_user.login, created_user.hashed_password) - .execute(); + session_.sql(sql_script).execute(); return uuid_str; } @@ -89,10 +87,7 @@ pair> MySQLUserDAO::GetAll(size_t limit, size_t offset) const string user_uuid = row[0].get(); const string user_login = row[1].get(); - user.login = user_login; - user.uuid = user_uuid; - - ret.second.push_back(std::move(user)); + ret.second.push_back({.uuid = user_uuid, .login = user_login}); --limit; } @@ -133,12 +128,10 @@ std::optional MySQLUserDAO::GetSingleUserBySQLResult(mysqlx::SqlResult&& s const string user_login = row_data[1].get(); const string user_hashed_password = row_data[2].get(); - user single_user; - - single_user.uuid = user_uuid; - single_user.login = user_login; - single_user.hashed_password = user_hashed_password; - - return optional(std::move(single_user)); + return optional({ + .uuid = user_uuid, + .login = user_login, + .hashed_password = user_hashed_password + }); } } // uad