vendredi 6 mars 2015

(c++) get data after executing mysql query group_concat


i have a question. i have a complex query and it contains group_concat.



MYSQL_RES* res = GetDBManager()->Query("select ls.time, count(ws.id) , group_concat(wc.id) , group_concat(ws.SIGNAL_STRENGTH) , ul.LATITUDE , ul.LONGITUDE , ul.ALTITUDE from user_location_scan ls, wifi_scan ws, wifi_cell wc, user_location ul where ls.id = ws.user_scan and ws.wifi_cell = wc.id and ls.time = ul.time group by ls.id order by ls.id");


how can i assign the data in group_concat to a struct such as



struct {
int APid;
double rssi;
}* sigstr;


i already tried a loop for() but it didn't work.



for (int i = 0; i < inf.numAP; i++) {
inf.sigstr[i].APid = atoi(row[j++]);
inf.sigstr[i].rssi = atof(row[j++]);
}


please help me.




Aucun commentaire:

Enregistrer un commentaire