source: network-game/server/DataAccess.h@ 7f9b01c

Last change on this file since 7f9b01c was 426fb84, checked in by Dmitry Portnoy <dmp1488@…>, 10 years ago

Save the actual time a game ends to the databse and send it to the client as part of a player's game history

  • Property mode set to 100644
File size: 871 bytes
Line 
1#ifndef _DATA_ACCESS_H
2#define _DATA_ACCESS_H
3
4#include <string>
5#include <list>
6
7#include <mysql/mysql.h>
8
9#include "../common/Player.h"
10
11using namespace std;
12
13class DataAccess {
14public:
15 DataAccess();
16 ~DataAccess();
17
18 Player* getPlayer(string username);
19 bool verifyPassword(string encrypted, string password);
20 int insertPlayer(string username, string password, Player::PlayerClass playerClass);
21 int updatePlayer(Player* player);
22
23 int* getPlayerRecord(int playerId);
24 int** getPlayerGameHistory(int playerId, unsigned int& numGames);
25 int saveGameHistory(int playerId, int team, int blueScore, int redScore, time_t timeFinished);
26
27 int insert(string table, string rows, string values);
28 int update(string table, string values, string where);
29 MYSQL_RES *select(string table, string filter);
30
31private:
32 MYSQL *connection, mysql;
33};
34
35#endif
Note: See TracBrowser for help on using the repository browser.