更新 '2.3.cpp'

master
Kirigaya Kazuto 2017-09-17 20:32:27 +08:00
parent 74cefd867a
commit 4b0eed8e40
1 changed files with 11 additions and 0 deletions

11
2.3.cpp
View File

@ -42,6 +42,17 @@ int main()
});
});
conn.exec("use bigdata2",nullptr);
conn.exec("select job_city,count(*) from pages group by job_city",[&](MySQLResult& res)
{
res.stepRow([&](char** val,unsigned long* len)
{
string city(val[0]);
int cc=ParseInt(val[1]);
mp[Trim(city)].push_back(cc);
});
});
ofstream ofs("result/2.3.csv");
for(auto iter=mp.begin();iter!=mp.end(); )