allow NULL as a parameter in transforms and FROM clause functions
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 6 Aug 2008 01:47:35 +0000 (01:47 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 6 Aug 2008 01:47:35 +0000 (01:47 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@10266 dcc99617-32d9-48b4-a31d-7c20da2025e4

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

index c580fa3..6aaab59 100644 (file)
@@ -1128,15 +1128,18 @@ static char* searchValueTransform( const jsonObject* array ) {
                else
                        buffer_add(sql_buf, ", ");
 
-               if ( dbi_conn_quote_string(dbhandle, &val) ) {
+               if (func_item->type == JSON_NULL) {
+                       buffer_add( sql_buf, "NULL" );
+               } else if ( dbi_conn_quote_string(dbhandle, &val) ) {
                        buffer_fadd( sql_buf, "%s", val );
-                       free(val);
                } else {
                        osrfLogError(OSRF_LOG_MARK, "%s: Error quoting key string [%s]", MODULENAME, val);
                        free(val);
                        buffer_free(sql_buf);
                        return NULL;
                }
+
+               free(val);
        }
 
        buffer_add(