Mania++
 All Classes Functions Variables Pages
Database.h
1 #ifndef DATABASE_H_
2 #define DATABASE_H_
3 
4 #include <string>
5 #include <sstream>
6 
7 #include "mysql_connection.h"
8 #include <cppconn/driver.h>
9 #include <cppconn/exception.h>
10 #include <cppconn/resultset.h>
11 #include <cppconn/statement.h>
12 
13 //* Database
17 class Database
18 {
19 public:
26  Database(std::string serverAddress, int serverPort = 3306);
27 
31  ~Database();
32 
40  sql::Connection* Connect(std::string username, std::string password, std::string database);
41 
42  sql::Driver* Driver;
43  sql::Connection* Connection;
45 private:
46  std::string address;
47  int port;
48 };
49 
50 #endif // DATABASE_H_
sql::Driver * Driver
Database server driver.
Definition: Database.h:42
Handles the connection to the database.
Definition: Database.h:17
int port
Port of the database server.
Definition: Database.h:47
sql::Connection * Connection
Database server driver.
Definition: Database.h:43
~Database()
Definition: Database.cpp:9
sql::Connection * Connect(std::string username, std::string password, std::string database)
Connects to the database.
Definition: Database.cpp:25
std::string address
IP Address of the database server.
Definition: Database.h:46
Database(std::string serverAddress, int serverPort=3306)
Sets a few settings.
Definition: Database.cpp:3