give cstore the ability to select a subcolumn from a complex datatype, using the...
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 1 Feb 2008 14:10:33 +0000 (14:10 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 1 Feb 2008 14:10:33 +0000 (14:10 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@8564 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/c-apps/oils_cstore.c

index dbdb7dd..364cfd9 100644 (file)
@@ -1142,6 +1142,7 @@ static char* searchFieldTransform (const char* class, osrfHash* field, const jso
        growing_buffer* sql_buf = buffer_init(32);
        
        char* field_transform = jsonObjectToSimpleString( jsonObjectGetKeyConst( node, "transform" ) );
+       char* transform_subcolumn = jsonObjectToSimpleString( jsonObjectGetKeyConst( node, "result_field" ) );
 
        if (field_transform) {
                buffer_fadd( sql_buf, "%s(\"%s\".%s", field_transform, class, osrfHashGet(field, "name"));
@@ -1170,12 +1171,21 @@ static char* searchFieldTransform (const char* class, osrfHash* field, const jso
                sql_buf,
                " )"
                );
+
        } else {
                buffer_fadd( sql_buf, "\"%s\".%s", class, osrfHashGet(field, "name"));
        }
 
+    if (transform_subcolumn) {
+               buffer_fadd(
+            sql_buf,
+            ".\"%s\"",
+            transform_subcolumn
+        );
+    }
        if (field_transform) free(field_transform);
+       if (transform_subcolumn) free(transform_subcolumn);
 
        return buffer_release(sql_buf);
 }