forest-net
an overlay networks for large-scale virtual worlds
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator
DBConnector.h
Go to the documentation of this file.
1 
9 #ifndef DBCONNECTOR_H
10 #define DBCONNECTOR_H
11 
12 //#include <stdlib.h>
13 //#include <iostream>
14 
15 #include "mysql_connection.h"
16 
17 #include <cppconn/driver.h>
18 #include <cppconn/exception.h>
19 #include <cppconn/resultset.h>
20 #include <cppconn/statement.h>
21 #include <cppconn/prepared_statement.h>
22 
23 using namespace std;
24 
25 namespace forest {
26 
27 class DBConnector {
28 private:
29  string dbServerAdr;
30  string dbId;
31  string dbPasswd;
32  string dbSchema;
33 
34  sql::Driver *driver;
35  sql::Connection *con;
36 
37 public:
38  struct adminProfile {
39  string name;
40  string realName;
41  string email;
42  };
43  DBConnector();
44  ~DBConnector();
45  bool isAdmin(string adminName, string passwd);
46  bool addAdmin(string newName, string passwd);
47  bool getAdminProfile(string adminName, adminProfile *profile);
48  bool updateAdminProfile(string adminName, adminProfile *profile);
49  bool setPassword(string adminName, string newPasswd);
50 };
51 
52 } // ends namespace
53 
54 
55 #endif