Class responsible for database operation. More...
#include <DBcontroler.h>
Public Member Functions | |||
DBcontroler () | |||
Constructor establishing a connection to the database. More... | |||
~DBcontroler () | |||
Destructor disconnection to the database. More... | |||
bool | checkUser (int id) | ||
Function check the user exists in the database. More... | |||
bool | checkUser (std::string login) | ||
Function check the user exists in the database. More... | |||
void | updateChampion (Champion *champ) | ||
Update function for data downloaded from player and amending the values in the database. More... | |||
void | addChampion (Champion *champ, int class_hero, int idUser) | ||
Function adding a new character to the database. More... | |||
void | addHeroes (int idUser) | ||
Function to assign the created champion to the user. More... | |||
void | deleteHeroes (int idUser, int idChampion) | ||
function removing to player's character. More... | |||
void | deleteHeroe (int idUser) | ||
function removing to player's character. More... | |||
bool | addUser (std::string login, std::string password) | ||
Function adding a new user. More... | |||
MYSQL_ROW | getUser (std::string login, std::string password) | ||
Function finding user id. More... | |||
MYSQL_RES * | getChampions (int id) | ||
Function finding all player's champions. More... | |||
MYSQL_ROW | getProf (int id) | ||
Function finds what class the characters is. More... | |||
Champion * | getChampion (int id) | ||
Function creates a new character
| |||
MYSQL_RES * | randomChampion (int id) | ||
Function finding 3 random character different to given id More... | |||
Class responsible for database operation.
DBcontroler::DBcontroler | ( | ) |
Constructor establishing a connection to the database.
DBcontroler::~DBcontroler | ( | ) |
Destructor disconnection to the database.
void DBcontroler::addChampion | ( | Champion * | champ, |
int | class_hero, | ||
int | idUser | ||
) |
Function adding a new character to the database.
champ | - Champion class object with generated basic statistics |
class_hero | - player's chosen character class |
idUser | - player's id |
void DBcontroler::addHeroes | ( | int | idUser | ) |
Function to assign the created champion to the user.
idUser | - player's id |
bool DBcontroler::addUser | ( | std::string | login, |
std::string | password | ||
) |
Function adding a new user.
login | - player's login |
password | - player's password |
bool DBcontroler::checkUser | ( | int | id | ) |
Function check the user exists in the database.
id | - id user |
bool DBcontroler::checkUser | ( | std::string | login | ) |
Function check the user exists in the database.
login | - login given by user |
void DBcontroler::deleteHeroe | ( | int | idUser | ) |
function removing to player's character.
idUser | - player's id |
void DBcontroler::deleteHeroes | ( | int | idUser, |
int | idChampion | ||
) |
function removing to player's character.
idUser | - player's id |
idChampion | - player's character id |
Champion * DBcontroler::getChampion | ( | int | id | ) |
Function creates a new character
id | - champion's id |
MYSQL_RES * DBcontroler::getChampions | ( | int | id | ) |
Function finding all player's champions.
id | - user's id |
MYSQL_ROW DBcontroler::getProf | ( | int | id | ) |
Function finds what class the characters is.
id | - champion's id |
MYSQL_ROW DBcontroler::getUser | ( | std::string | login, |
std::string | password | ||
) |
Function finding user id.
login | - user's login |
password | - user's password |
MYSQL_RES * DBcontroler::randomChampion | ( | int | id | ) |
Function finding 3 random character different to given id
id | - character's id |
void DBcontroler::updateChampion | ( | Champion * | champ | ) |
Update function for data downloaded from player and amending the values in the database.
champ | - player's object |