[open-ils-commits] r11178 - trunk/Open-ILS/src/c-apps

svn at svn.open-ils.org svn at svn.open-ils.org
Thu Nov 13 22:55:52 EST 2008


Author: miker
Date: 2008-11-13 22:55:50 -0500 (Thu, 13 Nov 2008)
New Revision: 11178

Modified:
   trunk/Open-ILS/src/c-apps/oils_cstore.c
Log:
add NOT EXISTS counterpart to EXISTS

Modified: trunk/Open-ILS/src/c-apps/oils_cstore.c
===================================================================
--- trunk/Open-ILS/src/c-apps/oils_cstore.c	2008-11-13 22:30:06 UTC (rev 11177)
+++ trunk/Open-ILS/src/c-apps/oils_cstore.c	2008-11-14 03:55:50 UTC (rev 11178)
@@ -1657,19 +1657,34 @@
                 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");



More information about the open-ils-commits mailing list