[open-ils-commits] r12378 - trunk/Open-ILS/src/c-apps (scottmk)

svn at svn.open-ils.org svn at svn.open-ils.org
Tue Mar 3 11:25:14 EST 2009


Author: scottmk
Date: 2009-03-03 11:25:09 -0500 (Tue, 03 Mar 2009)
New Revision: 12378

Modified:
   trunk/Open-ILS/src/c-apps/oils_cstore.c
Log:
In SELECT(): tweak the logic for handling the "aggregate" tag.

Previously we would build a GROUP BY clause if any field
carried the "aggregate" tag, even if the associated value 
was always false.  Now we respond to the "aggregate" tag
only if its value is true.


Modified: trunk/Open-ILS/src/c-apps/oils_cstore.c
===================================================================
--- trunk/Open-ILS/src/c-apps/oils_cstore.c	2009-03-03 15:59:44 UTC (rev 12377)
+++ trunk/Open-ILS/src/c-apps/oils_cstore.c	2009-03-03 16:25:09 UTC (rev 12378)
@@ -2628,7 +2628,6 @@
 
 		// Now build the actual select list
 	    int sel_pos = 1;
-	    //jsonObject* is_agg = jsonObjectFindPath(selhash, "//aggregate");
 	    first = 1;
 	    gfirst = 1;
 	    jsonIterator* selclass_itr = jsonNewIterator( selhash );
@@ -2654,7 +2653,6 @@
 						"Selected class is not defined"
 					);
 				jsonIteratorFree( selclass_itr );
-				//jsonObjectFree( is_agg );
 				buffer_free( sql_buf );
 				buffer_free( select_buf );
 				buffer_free( order_buf );
@@ -2720,7 +2718,6 @@
 						"Selected class not in FROM clause in JSON query"
 					);
 				jsonIteratorFree( selclass_itr );
-				//jsonObjectFree( is_agg );
 				buffer_free( sql_buf );
 				buffer_free( select_buf );
 				buffer_free( order_buf );
@@ -2773,7 +2770,6 @@
 							);
 						jsonIteratorFree( select_itr );
 						jsonIteratorFree( selclass_itr );
-						//jsonObjectFree( is_agg );
 						buffer_free( sql_buf );
 						buffer_free( select_buf );
 						buffer_free( order_buf );
@@ -2801,7 +2797,6 @@
 							);
 						jsonIteratorFree( select_itr );
 						jsonIteratorFree( selclass_itr );
-						//jsonObjectFree( is_agg );
 						buffer_free( sql_buf );
 						buffer_free( select_buf );
 						buffer_free( order_buf );
@@ -2856,7 +2851,6 @@
 							);
 						jsonIteratorFree( select_itr );
 						jsonIteratorFree( selclass_itr );
-						//jsonObjectFree( is_agg );
 						buffer_free( sql_buf );
 						buffer_free( select_buf );
 						buffer_free( order_buf );
@@ -2884,7 +2878,6 @@
 							);
 						jsonIteratorFree( select_itr );
 						jsonIteratorFree( selclass_itr );
-						//jsonObjectFree( is_agg );
 						buffer_free( sql_buf );
 						buffer_free( select_buf );
 						buffer_free( order_buf );
@@ -2919,7 +2912,6 @@
 								);
 							jsonIteratorFree( select_itr );
 							jsonIteratorFree( selclass_itr );
-							//jsonObjectFree( is_agg );
 							buffer_free( sql_buf );
 							buffer_free( select_buf );
 							buffer_free( order_buf );
@@ -2971,7 +2963,6 @@
 						);
 					jsonIteratorFree( select_itr );
 					jsonIteratorFree( selclass_itr );
-					//jsonObjectFree( is_agg );
 					buffer_free( sql_buf );
 					buffer_free( select_buf );
 					buffer_free( order_buf );
@@ -2983,10 +2974,9 @@
 				}
 
 				const jsonObject* agg_obj = jsonObjectGetKey( selfield, "aggregate" );
-				if( agg_obj )
+				if( obj_is_true( agg_obj ) )
 					aggregate_found = 1;
-
-				if( ( ! agg_obj ) || ( ! obj_is_true( agg_obj ) ) ) {
+				else {
 					// Append a comma (except for the first one)
 					// and add the column to a GROUP BY clause
 					if (gfirst)
@@ -3034,8 +3024,6 @@
 	    } // end while -- iterating across classes
 
         jsonIteratorFree(selclass_itr);
-
-	    //if (is_agg) jsonObjectFree(is_agg);
     }
 
 



More information about the open-ils-commits mailing list