Database handler get the freelancers salt

This commit is contained in:
Tina_Azure
2023-04-19 02:16:53 +02:00
parent c4a5256489
commit c0b2d150f9

View File

@ -55,6 +55,11 @@ namespace Database {
const static std::string PREPARED_STATEMENT_SELECT_CHECK_EMAIL_EXISTS = "selectCheckEmailExists";
const static std::string SQL_STATEMENT_SELECT_CHECK_EMAIL_EXISTS = "select count(*) from freelancers where emailaddress = $1;";
/*
* Name and Statement for prepared statement to get salt using a given email
*/
const static std::string PREPARED_STATEMENT_SELECT_FREELANCER_SALT = "selectFreelancerSalt";
const static std::string SQL_STATEMENT_SELECT_FREELANCER_SALT = "select salt from freelancers where emailaddress = $1;";
/*
* Name and Statement for prepared statement to select a freelancer based on a given id
*/
@ -313,6 +318,17 @@ namespace Database {
return result;
}
/*
* Executes the prepared statement SELECT_FREELANCER_SALT
* Takes an open pqxx::connection and the id to select by
*/
pqxx::result executePreparedStatement_SELECT_FREELANCER_SALT(pqxx::connection &connection, std::string freelancerEmail) {
connection.prepare(PREPARED_STATEMENT_SELECT_FREELANCER_SALT, SQL_STATEMENT_SELECT_FREELANCER_SALT);
pqxx::work work(connection);
pqxx::result result = work.exec_prepared(PREPARED_STATEMENT_SELECT_FREELANCER_SALT, freelancerEmail);
work.commit();
return result;
}
/*
* Executes the prepared statement SELECT_CHECK_EMAIL_EXISTS