[open-ils-commits] r8040 - trunk/Open-ILS/src/c-apps
svn at svn.open-ils.org
svn at svn.open-ils.org
Thu Nov 8 10:36:40 EST 2007
Author: miker
Date: 2007-11-08 10:20:48 -0500 (Thu, 08 Nov 2007)
New Revision: 8040
Modified:
trunk/Open-ILS/src/c-apps/oils_cstore.c
Log:
teach json_query in cstore about parameterized transforms (at least for output field transforms)
Modified: trunk/Open-ILS/src/c-apps/oils_cstore.c
===================================================================
--- trunk/Open-ILS/src/c-apps/oils_cstore.c 2007-11-08 14:42:13 UTC (rev 8039)
+++ trunk/Open-ILS/src/c-apps/oils_cstore.c 2007-11-08 15:20:48 UTC (rev 8040)
@@ -1140,10 +1140,37 @@
char* field_transform = jsonObjectToSimpleString( jsonObjectGetKey( node, "transform" ) );
- if (field_transform)
- buffer_fadd( sql_buf, "%s(\"%s\".%s)", field_transform, class, osrfHashGet(field, "name"));
- else
+ if (field_transform) {
+ buffer_fadd( sql_buf, "%s(\"%s\".%s", field_transform, class, osrfHashGet(field, "name"));
+ jsonObject* array = jsonObjectGetKey( node, "params" );
+
+ if (array) {
+ jsonObject* func_item;
+ while ( (func_item = jsonObjectGetIndex(array, func_item_index++)) ) {
+
+ val = jsonObjectToSimpleString(func_item);
+
+ if ( dbi_conn_quote_string(dbhandle, &val) ) {
+ buffer_fadd( sql_buf, ",%s", val );
+ free(val);
+ } else {
+ osrfLogError(OSRF_LOG_MARK, "%s: Error quoting key string [%s]", MODULENAME, val);
+ free(val);
+ free(field_transform);
+ buffer_free(sql_buf);
+ return NULL;
+ }
+ }
+
+ buffer_add(
+ sql_buf,
+ " )"
+ );
+ }
+
+ } else {
buffer_fadd( sql_buf, "\"%s\".%s", class, osrfHashGet(field, "name"));
+ }
char* pred = buffer_data(sql_buf);
buffer_free(sql_buf);
More information about the open-ils-commits
mailing list