Redirection template

Handle @alias via the redirection template
This commit is contained in:
Tina_Azure
2023-04-05 02:24:42 +02:00
parent 2738fdaf5c
commit 1a1908a814
3 changed files with 91 additions and 1 deletions

View File

@ -48,6 +48,12 @@ namespace Database {
const static std::string PREPARED_STATEMENT_SELECT_FREELANCER_TEMPLATES = "selectFreelancerTemplates";
const static std::string SQL_STATEMENT_SELECT_FREELANCER_TEMPLATES = "select id, name, content from templates where freelancerid = $1 order by id;";
/*
* Name and Statement for prepared statement to select an alias and its route via the alias name
*/
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;";
/*
* 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
@ -180,6 +186,18 @@ namespace Database {
return result;
}
/*
* Executes the prepared statement SELECT_ALIAS
* Takes an open pqxx::connection and the alias name to select by
*/
pqxx::result executePreparedStatement_SELECT_ALIAS(pqxx::connection &connection, std::string aliasName) {
connection.prepare(PREPARED_STATEMENT_SELECT_ALIAS, SQL_STATEMENT_SELECT_ALIAS);
pqxx::work work(connection);
pqxx::result result = work.exec_prepared(PREPARED_STATEMENT_SELECT_ALIAS, aliasName);
work.commit();
return result;
}
/*