From: scottmk Date: Tue, 14 Jul 2009 17:12:01 +0000 (+0000) Subject: For the id_list methods: build the SELECT clause directly X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=e061b6883ce30ed331396f4c54dfefc76d3c39d5;p=evergreen%2Ftadl.git For the id_list methods: build the SELECT clause directly instead of incurring the overhead of jsonParseStringFmt(). git-svn-id: svn://svn.open-ils.org/ILS/trunk@13588 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/src/c-apps/oils_cstore.c b/Open-ILS/src/c-apps/oils_cstore.c index a6af2c0b39..dff56e6966 100644 --- a/Open-ILS/src/c-apps/oils_cstore.c +++ b/Open-ILS/src/c-apps/oils_cstore.c @@ -824,15 +824,15 @@ int dispatchCRUDMethod ( osrfMethodContext* ctx ) { jsonObjectSetKey( rest_of_query, "no_i18n", jsonNewBoolObject( 1 ) ); - jsonObjectSetKey( - rest_of_query, - "select", - jsonParseStringFmt( - "{ \"%s\":[\"%s\"] }", - osrfHashGet( class_obj, "classname" ), - osrfHashGet( class_obj, "primarykey" ) - ) - ); + // Build a SELECT list containing just the primary key, + // i.e. like { "classname":["keyname"] } + jsonObject* col_list_obj = jsonNewObjectType( JSON_ARRAY ); + jsonObjectPush( col_list_obj, // Load array with name of primary key + jsonNewObject( osrfHashGet( class_obj, "primarykey" ) ) ); + jsonObject* select_clause = jsonNewObjectType( JSON_HASH ); + jsonObjectSetKey( select_clause, osrfHashGet( class_obj, "classname" ), col_list_obj ); + + jsonObjectSetKey( rest_of_query, "select", select_clause ); obj = doFieldmapperSearch( ctx, class_obj, where_clause, rest_of_query, &err );