generated from Sithas/conan_template
Успешное считывание пользователя
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
#include "MySQLUserDAO.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
using namespace string_literals;
|
||||
|
||||
@@ -21,8 +23,6 @@ optional<User> MySQLUserDAO::GetByGUID(string guid)
|
||||
|
||||
vector<User> MySQLUserDAO::GetAll()
|
||||
{
|
||||
auto const sql_query = session_.getSchemas();
|
||||
sql_query.
|
||||
vector<User> users {};
|
||||
|
||||
return {};
|
||||
|
||||
@@ -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<string>(rows.get(0));
|
||||
const auto& user_login = static_cast<string>(rows.get(1));
|
||||
const auto& user_hashed_password = static_cast<string>(rows.get(2));
|
||||
|
||||
net::io_context ioc{threads};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user