source: network-game/server/DataAccess.h@ 84754c0

Last change on this file since 84754c0 was 84754c0, checked in by Dmitry Portnoy <dmp1488@…>, 10 years ago

Change updatePlayer to take a Player object and update many fields of that object

  • Property mode set to 100644
File size: 882 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 list<Player*>* getPlayers();
20 bool verifyPassword(string encrypted, string password);
21 int insertPlayer(string username, string password, Player::PlayerClass playerClass);
22 int updatePlayer(Player* player);
23
24 int* getPlayerRecord(int playerId);
25 int** getPlayerGameHistory(int playerId, unsigned int& numGames);
26 int saveGameHistory(int playerId, int team, int blueScore, int redScore);
27
28 int insert(string table, string rows, string values);
29 int update(string table, string values, string where);
30 MYSQL_RES *select(string table, string filter);
31
32private:
33 MYSQL *connection, mysql;
34};
35
36#endif
Note: See TracBrowser for help on using the repository browser.