[open-ils-commits] r16932 - trunk/Open-ILS/src/c-apps (scottmk)

svn at svn.open-ils.org svn at svn.open-ils.org
Wed Jul 14 14:55:09 EDT 2010


Author: scottmk
Date: 2010-07-14 14:55:05 -0400 (Wed, 14 Jul 2010)
New Revision: 16932

Modified:
   trunk/Open-ILS/src/c-apps/buildSQL.c
Log:
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


Modified: trunk/Open-ILS/src/c-apps/buildSQL.c
===================================================================
--- trunk/Open-ILS/src/c-apps/buildSQL.c	2010-07-14 18:36:11 UTC (rev 16931)
+++ trunk/Open-ILS/src/c-apps/buildSQL.c	2010-07-14 18:55:05 UTC (rev 16932)
@@ -96,11 +96,15 @@
 			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 );



More information about the open-ils-commits mailing list