From: miker Date: Tue, 12 Oct 2010 15:19:54 +0000 (+0000) Subject: skip unknown order_by entries instead of erroring X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=8c80f83b7910884dd5ff84c91bdb2024414f2cd7;p=evergreen%2Ftadl.git skip unknown order_by entries instead of erroring git-svn-id: svn://svn.open-ils.org/ILS/trunk@18278 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/src/c-apps/oils_sql.c b/Open-ILS/src/c-apps/oils_sql.c index 7fb0fb65ce..0e8c445b1b 100644 --- a/Open-ILS/src/c-apps/oils_sql.c +++ b/Open-ILS/src/c-apps/oils_sql.c @@ -4416,26 +4416,10 @@ char* SELECT ( ClassInfo* order_class_info = search_alias( class_itr->key ); if( ! order_class_info ) { - osrfLogError( OSRF_LOG_MARK, - "%s: Invalid class \"%s\" referenced in ORDER BY clause", + osrfLogWarn( OSRF_LOG_MARK, + "%s: Invalid class \"%s\" referenced in ORDER BY clause, skipping it", modulename, class_itr->key ); - if( ctx ) - osrfAppSessionStatus( - ctx->session, - OSRF_STATUS_INTERNALSERVERERROR, - "osrfMethodException", - ctx->request, - "Invalid class referenced in ORDER BY clause -- " - "see error log for more details" - ); - jsonIteratorFree( class_itr ); - buffer_free( order_buf ); - free( having_buf ); - buffer_free( group_buf ); - buffer_free( sql_buf ); - if( defaultselhash ) - jsonObjectFree( defaultselhash ); - return NULL; + continue; } osrfHash* field_list_def = order_class_info->fields; @@ -4804,6 +4788,13 @@ static char* buildOrderByFromArray( osrfMethodContext* ctx, const jsonObject* or return NULL; } + const ClassInfo* order_class_info = search_alias( class_alias ); + if( ! order_class_info ) { + osrfLogWarn( OSRF_LOG_MARK, "%s: ORDER BY clause references class \"%s\" " + "not in FROM clause, skipping it", modulename, class_alias ); + continue; + } + const char* class_alias = jsonObjectGetString( jsonObjectGetKeyConst( order_spec, "class" )); const char* field = @@ -4831,22 +4822,6 @@ static char* buildOrderByFromArray( osrfMethodContext* ctx, const jsonObject* or return NULL; } - const ClassInfo* order_class_info = search_alias( class_alias ); - if( ! order_class_info ) { - osrfLogError( OSRF_LOG_MARK, "%s: ORDER BY clause references class \"%s\" " - "not in FROM clause", modulename, class_alias ); - if( ctx ) - osrfAppSessionStatus( - ctx->session, - OSRF_STATUS_INTERNALSERVERERROR, - "osrfMethodException", - ctx->request, - "Invalid class referenced in ORDER BY clause -- see error log for more details" - ); - free( order_buf ); - return NULL; - } - osrfHash* field_def = osrfHashGet( order_class_info->fields, field ); if( !field_def ) { osrfLogError( OSRF_LOG_MARK,