#include <db.hpp>
|
|
| Db (std::string filename) |
| |
| int | addUser (std::string username, std::string password) |
| |
| bool | authUser (std::string username, std::string password) |
| |
| int | updateTaste (std::string username, bool vote) |
| |
| int | getTaste (std::string uname) |
| |
| void | closeDatabase (void) |
| |
Db class is for all sqlite3 database interactions
◆ addUser()
| int Db::addUser |
( |
std::string |
username, |
|
|
std::string |
password |
|
) |
| |
Attempts to add a username with the given password to the database.
- Parameters
-
| username | username of the new user |
| password | the password of the new user |
- Returns
- the return code of the SQL query.
◆ authUser()
| bool Db::authUser |
( |
std::string |
username, |
|
|
std::string |
password |
|
) |
| |
Authenticates a user based on their username and password
- Parameters
-
| username | of the user to authernticate |
| password | password of the given user |
- Returns
- true if the user is authenticated, false otherwise
◆ closeDatabase()
| void Db::closeDatabase |
( |
void |
| ) |
|
Closes the sqlite3 database object
◆ getTaste()
| int Db::getTaste |
( |
std::string |
uname | ) |
|
Gets the taste of a given user from the database
- Parameters
-
| uname | username of the user |
- Returns
- taste of the user
◆ updateTaste()
| int Db::updateTaste |
( |
std::string |
username, |
|
|
bool |
vote |
|
) |
| |
Updates the taste for the given user depending on a given vote
- Parameters
-
| username | - username of taste to update |
| vote | - true for an upvote, false for a downvote |
- Returns
- int - the return code of the database query
The documentation for this class was generated from the following files: