From 4b0eed8e40825fa76725a050733d2c2316dd80b3 Mon Sep 17 00:00:00 2001 From: Kiritow <1362050620@qq.com> Date: Sun, 17 Sep 2017 20:32:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20'2.3.cpp'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 2.3.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/2.3.cpp b/2.3.cpp index b4733e7..2efbb00 100644 --- a/2.3.cpp +++ b/2.3.cpp @@ -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(); )