Files
Ivan I. Ovchinnikov 5cc25c3a40 initial
2026-05-28 22:15:38 +03:00

29 lines
929 B
C++

#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