From 343e0d7809f6067faa993ce7384bb8ca2acfe5f9 Mon Sep 17 00:00:00 2001 From: scottmk Date: Wed, 14 Jul 2010 18:55:05 +0000 Subject: [PATCH] When returning a list of bind variables: If a default_ or actual_value is undefined for a given variable, leave it out of the JSON object altogether, rather than create an entry with a JSON null for it. That way the client can distinguish between an undefined value and a value defined as null. M Open-ILS/src/c-apps/buildSQL.c git-svn-id: svn://svn.open-ils.org/ILS/trunk@16932 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/src/c-apps/buildSQL.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Open-ILS/src/c-apps/buildSQL.c b/Open-ILS/src/c-apps/buildSQL.c index 07f018f5a0..a2e008d787 100644 --- a/Open-ILS/src/c-apps/buildSQL.c +++ b/Open-ILS/src/c-apps/buildSQL.c @@ -96,11 +96,15 @@ jsonObject* oilsBindVarList( osrfHash* bindvar_list ) { attr = jsonNewObject( bind->description ); jsonObjectSetKey( bind_obj, "description", attr ); - attr = jsonObjectClone( bind->default_value ); - jsonObjectSetKey( bind_obj, "default_value", attr ); + if( bind->default_value ) { + attr = jsonObjectClone( bind->default_value ); + jsonObjectSetKey( bind_obj, "default_value", attr ); + } - attr = jsonObjectClone( bind->actual_value ); - jsonObjectSetKey( bind_obj, "actual_value", attr ); + if( bind->actual_value ) { + attr = jsonObjectClone( bind->actual_value ); + jsonObjectSetKey( bind_obj, "actual_value", attr ); + } // Add the bind variable to the list jsonObjectSetKey( list, osrfHashIteratorKey( iter ), bind_obj ); -- 2.43.2