database request to update the login validation key of a freelancer
This commit is contained in:
@ -101,6 +101,11 @@ namespace Database {
|
|||||||
const static std::string PREPARED_STATEMENT_SELECT_ALIAS = "selectAlias";
|
const static std::string PREPARED_STATEMENT_SELECT_ALIAS = "selectAlias";
|
||||||
const static std::string SQL_STATEMENT_SELECT_ALIAS = "select aliasname, route, routeparameter, routevalue from aliasroutes where aliasname = $1;";
|
const static std::string SQL_STATEMENT_SELECT_ALIAS = "select aliasname, route, routeparameter, routevalue from aliasroutes where aliasname = $1;";
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Name and Statement for prepared statement to update the loginvalidationkey of a freelancer via the freelancerID
|
||||||
|
*/
|
||||||
|
const static std::string PREPARED_STATEMENT_UPDATE_LOGIN_VALIDATION_KEY = "updateLoginValidationKey";
|
||||||
|
const static std::string SQL_STATEMENT_UPDATE_LOGIN_VALIDATION_KEY = "update freelancers set loginvalidationkey = $1 where emailaddress = $2;";
|
||||||
/*
|
/*
|
||||||
* Selects freelancers, their basicInfo and if the commissions are closed/open ordered by name.
|
* Selects freelancers, their basicInfo and if the commissions are closed/open ordered by name.
|
||||||
* Delivers if the commission limit has been reached and if the commissions are closed based on the accepted/completed state of the freelancers requests
|
* Delivers if the commission limit has been reached and if the commissions are closed based on the accepted/completed state of the freelancers requests
|
||||||
@ -444,6 +449,17 @@ namespace Database {
|
|||||||
connection.unprepare(PREPARED_STATEMENT_SELECT_ALIAS);
|
connection.unprepare(PREPARED_STATEMENT_SELECT_ALIAS);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Executes the prepared statement UPDATE_LOGIN_VALIDATION_KEY
|
||||||
|
* Takes an open pqxx::connection, the freelancerID and the loginKey to update the entry
|
||||||
|
*/
|
||||||
|
pqxx::result executePreparedStatement_UPDATE_LOGIN_VALIDATION_KEY(pqxx::connection &connection, const std::string& loginKey, const std::string& freelancerEmail) {
|
||||||
|
connection.prepare(PREPARED_STATEMENT_UPDATE_LOGIN_VALIDATION_KEY, SQL_STATEMENT_UPDATE_LOGIN_VALIDATION_KEY);
|
||||||
|
pqxx::work work(connection);
|
||||||
|
pqxx::result result = work.exec_prepared(PREPARED_STATEMENT_UPDATE_LOGIN_VALIDATION_KEY, loginKey, freelancerEmail);
|
||||||
|
work.commit();
|
||||||
|
connection.unprepare(PREPARED_STATEMENT_UPDATE_LOGIN_VALIDATION_KEY);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user