For create and update methods: accept boolean column values
authorscottmk <scottmk@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 12 Aug 2009 15:19:49 +0000 (15:19 +0000)
committerscottmk <scottmk@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 12 Aug 2009 15:19:49 +0000 (15:19 +0000)
as JSON_BOOLs instead of requiring them to be encoded as
"t" or "f" strings.

git-svn-id: svn://svn.open-ils.org/ILS/trunk@13815 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/c-apps/oils_cstore.c

index 27ec54a..4bfb818 100644 (file)
@@ -1497,6 +1497,11 @@ static jsonObject* doCreate(osrfMethodContext* ctx, int* err ) {
                                field_object,
                                (char*)oilsIDLFindPath("/%s/primarykey", field_object->classname)
                        );
+               } else if( JSON_BOOL == field_object->type ) {
+                       if( jsonBoolIsTrue( field_object ) )
+                               value = strdup( "t" );
+                       else
+                               value = strdup( "f" );
                } else {
                        value = jsonObjectToSimpleString( field_object );
                }
@@ -4733,7 +4738,12 @@ static jsonObject* doUpdate(osrfMethodContext* ctx, int* err ) {
                        value = oilsFMGetString(
                                field_object,
                                (char*)oilsIDLFindPath("/%s/primarykey", field_object->classname)
-            );
+                       );
+               } else if( JSON_BOOL == field_object->type ) {
+                       if( jsonBoolIsTrue( field_object ) )
+                               value = strdup( "t" );
+                       else
+                               value = strdup( "f" );
                } else {
                        value = jsonObjectToSimpleString( field_object );
                        if( field_object && JSON_NUMBER == field_object->type )