[open-ils-commits] r8124 - trunk/Open-ILS/src/c-apps
svn at svn.open-ils.org
svn at svn.open-ils.org
Sat Dec 1 22:07:16 EST 2007
Author: miker
Date: 2007-12-01 21:48:07 -0500 (Sat, 01 Dec 2007)
New Revision: 8124
Modified:
trunk/Open-ILS/src/c-apps/oils_cstore.c
Log:
split WHERE and HAVING predicate creation
Modified: trunk/Open-ILS/src/c-apps/oils_cstore.c
===================================================================
--- trunk/Open-ILS/src/c-apps/oils_cstore.c 2007-12-02 02:27:33 UTC (rev 8123)
+++ trunk/Open-ILS/src/c-apps/oils_cstore.c 2007-12-02 02:48:07 UTC (rev 8124)
@@ -1917,15 +1917,14 @@
// and it's on the the WHERE clause
char* pred = searchWHERE( search_hash, core_meta, AND_OP_JOIN );
- char* having_pred = searchWHERE( having_hash, core_meta, AND_OP_JOIN );
- if (!pred || !having_pred) {
+ if (!pred) {
osrfAppSessionStatus(
ctx->session,
OSRF_STATUS_INTERNALSERVERERROR,
"osrfMethodException",
ctx->request,
- "Severe query error -- see error log for more details"
+ "Severe query error in WHERE predicate -- see error log for more details"
);
free(core_class);
buffer_free(having_buf);
@@ -1938,6 +1937,33 @@
buffer_add(sql_buf, pred);
free(pred);
}
+ }
+
+ if ( having_hash ) {
+ buffer_add(sql_buf, " HAVING ");
+
+ // and it's on the the WHERE clause
+ char* pred = searchWHERE( having_hash, core_meta, AND_OP_JOIN );
+
+ if (!pred) {
+ osrfAppSessionStatus(
+ ctx->session,
+ OSRF_STATUS_INTERNALSERVERERROR,
+ "osrfMethodException",
+ ctx->request,
+ "Severe query error in HAVING predicate -- see error log for more details"
+ );
+ free(core_class);
+ buffer_free(having_buf);
+ buffer_free(group_buf);
+ buffer_free(order_buf);
+ buffer_free(sql_buf);
+ if (defaultselhash) jsonObjectFree(defaultselhash);
+ return NULL;
+ } else {
+ buffer_add(sql_buf, pred);
+ free(pred);
+ }
}
first = 1;
More information about the open-ils-commits
mailing list