AppChat  0.5.0
TCP client-server caht application with boost::asio library.
database.h
1 #ifndef DATABASE_H
2 #define DATABASE_H
3 
4 #include "protocol/protocol.h"
5 #include <deque>
6 #include <sqlite3.h>
7 #include "server/log/logger.h"
8 #include <memory>
9 #include <boost/filesystem.hpp>
10 
11 class Database
12 {
13 public:
14  Database();
15  ~Database();
16 
17  void save_text_message(text_request_ptr message);
18  std::deque<text_response_ptr> get_history(identifier_t roomid);
19 
20  void add_logins(std::string login, identifier_t logi_id, std::string password);
21 
22  identifier_t get_loginid(std::string login) const;
23 
24  identifier_t check_client(std::string login, std::string password) const;
25 
26 private:
27  std::string db_name;
28  sqlite3* db_ptr = NULL;
29  static std::string create_table_history;
30  static std::string create_table_logins;
31 
32 };
33 
34 using database_ptr = std::shared_ptr<Database>;
35 
36 #endif // DATABASE_H
Definition: database.h:11
Database()
Database::Database.
Definition: database.cpp:25