From: miker Date: Fri, 26 Mar 2010 19:07:58 +0000 (+0000) Subject: add support for DISTINCT on aggregate function, like COUNT( DISTINCT x ) X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=98c89ac0802816338abd9dc3bbde6e005581b4b1;p=evergreen%2Fmasslnc.git add support for DISTINCT on aggregate function, like COUNT( DISTINCT x ) git-svn-id: svn://svn.open-ils.org/ILS/trunk@16010 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/src/c-apps/oils_cstore.c b/Open-ILS/src/c-apps/oils_cstore.c index d7e130fa2b..63c1358386 100644 --- a/Open-ILS/src/c-apps/oils_cstore.c +++ b/Open-ILS/src/c-apps/oils_cstore.c @@ -2564,8 +2564,14 @@ static char* searchFieldTransform (const char* class_alias, osrfHash* field, con return NULL; } - buffer_fadd( sql_buf, "%s(\"%s\".%s", - field_transform, class_alias, osrfHashGet(field, "name")); + if( obj_is_true( jsonObjectGetKeyConst( node, "distinct" ) ) ) { + buffer_fadd( sql_buf, "%s(DISTINCT \"%s\".%s", + field_transform, class_alias, osrfHashGet(field, "name")); + } else { + buffer_fadd( sql_buf, "%s(\"%s\".%s", + field_transform, class_alias, osrfHashGet(field, "name")); + } + const jsonObject* array = jsonObjectGetKeyConst( node, "params" ); if (array) {