This commit is contained in:
Ivan I. Ovchinnikov
2026-05-28 22:15:38 +03:00
commit 5cc25c3a40
9 changed files with 255 additions and 0 deletions
@@ -0,0 +1,29 @@
#ifndef SQLITE_CLIENT_LIBRARY_H
#define SQLITE_CLIENT_LIBRARY_H
#include <string>
#include <optional>
#include <mutex>
#include <sqlite3.h>
namespace iovi_space {
class SqlClient {
public:
// Подключение к БД. Путь по умолчанию совпадает с вашим Java-проектом.
static void connect(const std::string& db_path = "chat-server/chat.db");
// Закрытие соединения
static void disconnect();
// Поиск никнейма. Возвращает std::nullopt, если пользователь не найден.
static std::optional<std::string> getNickname(const std::string& login, const std::string& password);
private:
static sqlite3* connection;
static std::mutex db_mutex; // Замена synchronized из Java
};
} // namespace iovi_space
#endif // SQLITE_CLIENT_LIBRARY_H