[open-ils-commits] r13588 - trunk/Open-ILS/src/c-apps (scottmk)
svn at svn.open-ils.org
svn at svn.open-ils.org
Tue Jul 14 13:12:03 EDT 2009
Author: scottmk
Date: 2009-07-14 13:12:01 -0400 (Tue, 14 Jul 2009)
New Revision: 13588
Modified:
trunk/Open-ILS/src/c-apps/oils_cstore.c
Log:
For the id_list methods: build the SELECT clause directly
instead of incurring the overhead of jsonParseStringFmt().
Modified: trunk/Open-ILS/src/c-apps/oils_cstore.c
===================================================================
--- trunk/Open-ILS/src/c-apps/oils_cstore.c 2009-07-14 16:39:17 UTC (rev 13587)
+++ trunk/Open-ILS/src/c-apps/oils_cstore.c 2009-07-14 17:12:01 UTC (rev 13588)
@@ -824,16 +824,16 @@
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 );
jsonObjectFree( rest_of_query );
More information about the open-ils-commits
mailing list