Skip to content

Commit

Permalink
segments & clinched table speed (yakra#213)
Browse files Browse the repository at this point in the history
  • Loading branch information
yakra committed Mar 31, 2024
1 parent 5e8ebb8 commit 0ff0af1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions siteupdate/cplusplus/functions/sql_file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ void sqlfile1
<< "), PRIMARY KEY (segmentId), FOREIGN KEY (waypoint1) REFERENCES waypoints(pointId), "
<< "FOREIGN KEY (waypoint2) REFERENCES waypoints(pointId), FOREIGN KEY (root) REFERENCES routes(root));\n";
unsigned int segment_num = point_num = 0;
std::vector<std::string> clinched_list;
std::vector<std::pair<unsigned int, const char*>> clinched_list;
for (HighwaySystem& h : HighwaySystem::syslist)
for (Route& r : h.routes)
{ sqlfile << "INSERT INTO segments VALUES\n";
Expand All @@ -237,7 +237,7 @@ void sqlfile1
sqlfile << "','" << point_num;
sqlfile << "','" << r.root << "')\n";
for (TravelerList *t : s.clinched_by)
clinched_list.push_back("'" + std::to_string(segment_num) + "','" + t->traveler_name + "'");
clinched_list.emplace_back(segment_num, t->traveler_name.data());
segment_num += 1;
}
sqlfile << ";\n";
Expand All @@ -257,7 +257,7 @@ void sqlfile1
for (size_t c = start; c < start+10000 && c < clinched_list.size(); c++)
{ if (!first) sqlfile << ',';
first = 0;
sqlfile << '(' << clinched_list[c] << ")\n";
sqlfile << "('" << clinched_list[c].first << "','" << clinched_list[c].second << "')\n";
}
sqlfile << ";\n";
}
Expand Down

0 comments on commit 0ff0af1

Please sign in to comment.