我有一個查詢字符串形成一個std :: string,查詢有4個點,每個點有一個x,y,他們每個是雙數據類型。Concatening字符串這樣做的最佳方式是什麼?
我將如何將字符串連接到放4個點(8個變量)查詢中使用C++
'MULTIPOINT(16.17951 47.85549, 16.17951 47.85549, 16.17951 47.85549, 16.17951 47.85549)';
這裏是查詢的形式:
string query = "SELECT * from areas WHERE st_contains(ST_ConvexHull(areas.GEOMETRY),st_mpointfromtext('MULTIPOINT(16.17951 47.85549, 16.17951 47.85549, 16.17951 47.85549, 16.17951 47.85549)',4326));";
double x1 = 6.17951, x2 = 6.17951, x3 = 6.17951, x4 = 6.17951;
double y1 = 7.85549, y2 = 7.85549, y3 = 7.85549, y4 = 7.85549;
/* std::string query = "SELECT * from areas WHERE st_contains(ST_ConvexHull(areas.GEOMETRY),st_mpointfromtext('MULTIPOINT("
+ to_string(x1) + " " + to_string(y1) + ", "
+ to_string(x2) + " " + to_string(y2) + ", "
+ to_string(x3) + " " + to_string(y3) + ", "
+ to_string(x4) + " " + to_string(y4) + "',4326));";
*/
string query = "SELECT * from areas WHERE st_contains(ST_ConvexHull(areas.GEOMETRY),st_mpointfromtext('MULTIPOINT(6.17951 7.85549, 6.17951 7.85549, 6.17951 7.85549, 6.17951 7.85549)',4326));";
聽起來像你」重新尋找['std :: stringstream'](http://en.cppreference.com/w/cpp/io/basic_stringstream)? –