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
RevLine 
[53643ca]1#ifndef _DATA_ACCESS_H
[36082e8]2#define _DATA_ACCESS_H
3
[59061f6]4#include <string>
[b128109]5#include <list>
[59061f6]6
7#include <mysql/mysql.h>
8
[edfd1d0]9#include "../common/Player.h"
[59061f6]10
11using namespace std;
12
[36082e8]13class DataAccess {
14public:
15 DataAccess();
16 ~DataAccess();
17
[b128109]18 Player* getPlayer(string username);
19 list<Player*>* getPlayers();
20 bool verifyPassword(string encrypted, string password);
[53643ca]21 int insertPlayer(string username, string password, Player::PlayerClass playerClass);
[84754c0]22 int updatePlayer(Player* player);
[53643ca]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);
[59061f6]27
28 int insert(string table, string rows, string values);
[b128109]29 int update(string table, string values, string where);
[59061f6]30 MYSQL_RES *select(string table, string filter);
31
32private:
33 MYSQL *connection, mysql;
[36082e8]34};
35
36#endif
Note: See TracBrowser for help on using the repository browser.