From: miker Date: Fri, 14 Nov 2008 03:55:50 +0000 (+0000) Subject: add NOT EXISTS counterpart to EXISTS X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=22abf4d72bbd5db0a24210723295b768c699657d;p=Evergreen.git add NOT EXISTS counterpart to EXISTS git-svn-id: svn://svn.open-ils.org/ILS/trunk@11178 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 a10563f2d1..ae10adb9d3 100644 --- a/Open-ILS/src/c-apps/oils_cstore.c +++ b/Open-ILS/src/c-apps/oils_cstore.c @@ -1657,19 +1657,34 @@ static char* searchWHERE ( const jsonObject* search_hash, osrfHash* meta, int op free(subpred); } else if ( !strcasecmp("-exists",search_itr->key) ) { char* subpred = SELECT( - ctx, - jsonObjectGetKey( node, "select" ), - jsonObjectGetKey( node, "from" ), - jsonObjectGetKey( node, "where" ), - jsonObjectGetKey( node, "having" ), - jsonObjectGetKey( node, "order_by" ), - jsonObjectGetKey( node, "limit" ), - jsonObjectGetKey( node, "offset" ), - SUBSELECT + ctx, + jsonObjectGetKey( node, "select" ), + jsonObjectGetKey( node, "from" ), + jsonObjectGetKey( node, "where" ), + jsonObjectGetKey( node, "having" ), + jsonObjectGetKey( node, "order_by" ), + jsonObjectGetKey( node, "limit" ), + jsonObjectGetKey( node, "offset" ), + SUBSELECT ); buffer_fadd(sql_buf, "EXISTS ( %s )", subpred); free(subpred); + } else if ( !strcasecmp("-not-exists",search_itr->key) ) { + char* subpred = SELECT( + ctx, + jsonObjectGetKey( node, "select" ), + jsonObjectGetKey( node, "from" ), + jsonObjectGetKey( node, "where" ), + jsonObjectGetKey( node, "having" ), + jsonObjectGetKey( node, "order_by" ), + jsonObjectGetKey( node, "limit" ), + jsonObjectGetKey( node, "offset" ), + SUBSELECT + ); + + buffer_fadd(sql_buf, "NOT EXISTS ( %s )", subpred); + free(subpred); } else { char* class = osrfHashGet(meta, "classname");