group count
This commit is contained in:
@@ -1790,6 +1790,20 @@ wrenchboard=> SELECT group_id,count(id) FROM members_job_groupmember WHERE membe
|
||||
|
||||
wrenchboard=>
|
||||
*/
|
||||
|
||||
const PGresult *res2 = pgsql_query("SELECT group_id,count(id) AS group_count "
|
||||
" FROM members_job_groupmember WHERE member_id = %lu GROUP BY group_id",member_id);
|
||||
if (res2 != NULL && pgsql_num_rows(res2) > 0) {
|
||||
for (int i = 0, n = pgsql_num_rows(res2); i < n; i++) {
|
||||
map<const char*, const char*>f = pgsql_fetch_assoc(res2, i);
|
||||
if (f.empty()) continue;
|
||||
map_to_cvars(f, rec);
|
||||
|
||||
snprintf(vname, sizeof (vname), "group_count_id_%d", rec["group_id"].Long());
|
||||
out[vname] = rec["group_count"];
|
||||
}
|
||||
}
|
||||
|
||||
ret = PHP_API_OK;
|
||||
|
||||
} catch (bad_parameter) {
|
||||
|
||||
Reference in New Issue
Block a user