From: scottmk Date: Wed, 14 Jul 2010 18:55:05 +0000 (+0000) Subject: When returning a list of bind variables: If a default_ or actual_value X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=343e0d7809f6067faa993ce7384bb8ca2acfe5f9;p=evergreen%2Fbjwebb.git 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 --- diff --git a/Open-ILS/src/c-apps/buildSQL.c b/Open-ILS/src/c-apps/buildSQL.c index 07f018f5a..a2e008d78 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 );