Create new Template
+minor refactoring
This commit is contained in:
@ -548,6 +548,33 @@ namespace Database {
|
||||
work.commit();
|
||||
}
|
||||
|
||||
/*
|
||||
* Executes the prepared statement INSERT_FREELANCER_TEMPLATE
|
||||
* Takes an open pqxx::connection and the strings name, content, contactdata, contactinformation, currencypreference, priceupfront, priceondeliver, freelancerEmail
|
||||
* returns errorLevel
|
||||
* 0 = no error
|
||||
* 1 = query error
|
||||
* 2 = critical error
|
||||
*/
|
||||
int executePreparedStatement_INSERT_FREELANCER_TEMPLATE(pqxx::connection &connection, const std::string& name, const std::string& content, const std::string& contactdata, const std::string& contactinformation, const std::string& currencypreference, const std::string& priceupfront, const std::string& priceondeliver, const std::string& freelancerEmail) {
|
||||
try {
|
||||
pqxx::work work(connection);
|
||||
work.exec_prepared(PREPARED_STATEMENT_INSERT_FREELANCER_TEMPLATE, name, content, contactdata, contactinformation, currencypreference, priceupfront, priceondeliver, freelancerEmail);
|
||||
work.commit();
|
||||
}
|
||||
catch (pqxx::sql_error const &e) {
|
||||
std::cerr
|
||||
<< "Database error: " << e.what() << std::endl
|
||||
<< "Query was: " << e.query() << std::endl;
|
||||
return 1;
|
||||
}
|
||||
catch (std::exception const &e) {
|
||||
std::cerr << e.what() << std::endl;
|
||||
return 2;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Prepares a statement based on ID
|
||||
* Takes an open pqxx::connection, the statement id
|
||||
|
Reference in New Issue
Block a user