diff --git a/siteupdate/cplusplus/classes/DBFieldLength/DBFieldLength.cpp b/siteupdate/cplusplus/classes/DBFieldLength/DBFieldLength.cpp index b040f1eb..0acfc101 100644 --- a/siteupdate/cplusplus/classes/DBFieldLength/DBFieldLength.cpp +++ b/siteupdate/cplusplus/classes/DBFieldLength/DBFieldLength.cpp @@ -30,6 +30,7 @@ const size_t DBFieldLength::systemFullName = 60; const size_t DBFieldLength::systemName = 10; const size_t DBFieldLength::traveler = 48; const size_t DBFieldLength::updateText = 1024; +const size_t DBFieldLength::listDescription = 1024; // sums of other constants const size_t DBFieldLength::countryRegion = DBFieldLength::countryName + DBFieldLength::regionName + 3; const size_t DBFieldLength::dcErrValue = DBFieldLength::root + DBFieldLength::label + 1;; diff --git a/siteupdate/cplusplus/classes/DBFieldLength/DBFieldLength.h b/siteupdate/cplusplus/classes/DBFieldLength/DBFieldLength.h index 7fe8b294..63fd3612 100644 --- a/siteupdate/cplusplus/classes/DBFieldLength/DBFieldLength.h +++ b/siteupdate/cplusplus/classes/DBFieldLength/DBFieldLength.h @@ -32,6 +32,7 @@ class DBFieldLength static const size_t systemName; static const size_t traveler; static const size_t updateText; + static const size_t listDescription; // sums of other constants static const size_t countryRegion; static const size_t dcErrValue; diff --git a/siteupdate/cplusplus/functions/sql_file.cpp b/siteupdate/cplusplus/functions/sql_file.cpp index 96dd72ac..d0514738 100644 --- a/siteupdate/cplusplus/functions/sql_file.cpp +++ b/siteupdate/cplusplus/functions/sql_file.cpp @@ -33,6 +33,7 @@ void sqlfile1 sqlfile << "DROP TABLE IF EXISTS clinchedRoutes;\n"; sqlfile << "DROP TABLE IF EXISTS clinchedOverallMileageByRegion;\n"; sqlfile << "DROP TABLE IF EXISTS clinchedSystemMileageByRegion;\n"; + sqlfile << "DROP TABLE IF EXISTS listEntries;\n"; sqlfile << "DROP TABLE IF EXISTS overallMileageByRegion;\n"; sqlfile << "DROP TABLE IF EXISTS systemMileageByRegion;\n"; sqlfile << "DROP TABLE IF EXISTS clinched;\n"; @@ -389,6 +390,35 @@ void sqlfile1 sqlfile << ";\n"; } + // list entries + #ifndef threading_enabled + std::cout << et->et() << "...listEntries" << std::endl; + #endif + sqlfile << "CREATE TABLE listEntries (traveler VARCHAR(" << DBFieldLength::traveler + << "), description VARCHAR(" << DBFieldLength::listDescription + << "), includeInRanks BOOLEAN);\n"; + sqlfile << "INSERT INTO listEntries VALUES\n"; + first = 1; + for (TravelerList& t : TravelerList::allusers) + { if (!first) sqlfile << ','; + first = 0; + // look for this traveler in the listinfo map + auto it = TravelerList::listinfo.find(t.traveler_name); + // if found, use the description and includeInRanks values from the map + if (it != TravelerList::listinfo.end()) + { sqlfile << "('" << t.traveler_name << "','" << double_quotes(it->second[0]) << "'," << (it->second[1] == "1" ? "TRUE" : "FALSE") << ")\n"; + // remove it from the map + TravelerList::listinfo.erase(it); + } + else + { // use the defaults + sqlfile << "('" << t.traveler_name << "','" << double_quotes(TravelerList::defaults[0]) << "'," << (TravelerList::defaults[1] == "1" ? "TRUE" : "FALSE") << ")\n"; + } + } + sqlfile << ";\n"; + + // report any remaining entries in the listinfo map as errors (TODO) + // updates entries #ifndef threading_enabled std::cout << et->et() << "...updates" << std::endl;