From 64fbe5fcb937e26de379011864da87d96cdfa3c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BD=D1=82=D0=BE=D0=BD?= Date: Thu, 28 Aug 2025 18:38:07 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A3=D1=81=D0=BF=D0=B5=D1=88=D0=BD=D0=BE?= =?UTF-8?q?=D0=B5=20=D1=81=D1=87=D0=B8=D1=82=D1=8B=D0=B2=D0=B0=D0=BD=D0=B8?= =?UTF-8?q?=D0=B5=20=D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=82?= =?UTF-8?q?=D0=B5=D0=BB=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/DAO/MySQLUserDAO.cpp | 4 ++-- src/main.cpp | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/DAO/MySQLUserDAO.cpp b/src/DAO/MySQLUserDAO.cpp index 96e562e..ed5f1f5 100644 --- a/src/DAO/MySQLUserDAO.cpp +++ b/src/DAO/MySQLUserDAO.cpp @@ -1,5 +1,7 @@ #include "MySQLUserDAO.h" +#include + using namespace std; using namespace string_literals; @@ -21,8 +23,6 @@ optional MySQLUserDAO::GetByGUID(string guid) vector MySQLUserDAO::GetAll() { - auto const sql_query = session_.getSchemas(); - sql_query. vector users {}; return {}; diff --git a/src/main.cpp b/src/main.cpp index 48796c4..4c840f0 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -18,6 +18,7 @@ #include "./session/WebsocketSession.h" #include "./listener/Listener.h" #include "./db/mysql_connector.h" +#include "entities/User.h" namespace beast = boost::beast; namespace http = beast::http; @@ -44,6 +45,21 @@ int main(int argc, char* argv[]) string mysql_credentials = argv[5]; uad::SetMySqlSession(new mysqlx::Session(mysql_credentials)); + auto& session = uad::GetMySqlSession(); + + auto schema = session.getSchema("up_and_down"); + + auto collections_names = schema.getCollectionNames(); + auto users_collection = schema.getCollection("users"); + auto users_collection_2 = session.sql("SELECT * FROM up_and_down.users;").execute(); + + auto users_rows = users_collection_2.fetchAll(); + + auto rows = *users_rows.begin(); + + const auto& user_guid = static_cast(rows.get(0)); + const auto& user_login = static_cast(rows.get(1)); + const auto& user_hashed_password = static_cast(rows.get(2)); net::io_context ioc{threads};