Amendment of spec: Templates shall utilize only lower-case variable names
Removal of workaround for lowercase column names Apropriately changed the test.html
This commit is contained in:
@ -2,7 +2,6 @@
|
||||
#include <list>
|
||||
#include <iostream>
|
||||
#include <pqxx/pqxx>
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include "crow.h"
|
||||
|
||||
|
||||
@ -21,7 +20,7 @@ namespace Database {
|
||||
* Case for boolean return values because the default return value is f/t instead of 0/1 or false/true
|
||||
*/
|
||||
const static std::string PREPARED_STATEMENT_SELECT_ITEM_BY_ID = "selectItemByID";
|
||||
const static std::string SQL_STATEMENT_SELECT_ITEM_BY_ID = "SELECT id , customerEmailAddress, freelancer, templateName, currencyPreference, priceUpFront, priceOnDeliver, requestDescription, (CASE WHEN requests.accepted THEN 1 ELSE 0 END) AS accepted, upFrontInvoiceID, onDeliverInvoiceID, (CASE WHEN requests.upFrontPaid THEN 1 ELSE 0 END) AS upFrontPaid, (CASE WHEN requests.onDeliverPaid THEN 1 ELSE 0 END) AS onDeliverPaid FROM requests WHERE id=$1;";
|
||||
const static std::string SQL_STATEMENT_SELECT_ITEM_BY_ID = "SELECT id , customerEmailAddress, freelancer, templateName, currencyPreference, priceUpFront, priceOnDeliver, requestDescription, (CASE WHEN requests.accepted THEN 1 ELSE 0 END) AS accepted, upFrontInvoiceID, onDeliverInvoiceID, (CASE WHEN requests.upFrontPaid THEN 1 ELSE 0 END) AS upFrontPaid, (CASE WHEN requests.onDeliverPaid THEN 1 ELSE 0 END) AS onDeliverPaid FROM requests WHERE id=$1;";
|
||||
|
||||
/*
|
||||
* Struct Representing an item in Requests
|
||||
@ -109,14 +108,7 @@ namespace Database {
|
||||
crow::json::wvalue convertResultRowToJSON(pqxx::result &result, int row = 0){
|
||||
crow::json::wvalue returnJson;
|
||||
for (int i = 0; i < result.columns(); ++i) {
|
||||
std::string realColName = result.column_name(i);
|
||||
for (std::string columnNameReal: JSON_ITEM_NAMES) {
|
||||
if (boost::algorithm::to_lower_copy(columnNameReal) == realColName) {
|
||||
realColName = columnNameReal;
|
||||
break;
|
||||
}
|
||||
}
|
||||
returnJson[realColName] = result.at(row).at(i).c_str();
|
||||
returnJson[result.column_name(i)] = result.at(row).at(i).c_str();
|
||||
}
|
||||
return returnJson;
|
||||
}
|
||||
|
Reference in New Issue
Block a user