[open-ils-commits] r18279 - trunk/Open-ILS/src/c-apps (miker)

svn at svn.open-ils.org svn at svn.open-ils.org
Tue Oct 12 11:39:50 EDT 2010


Author: miker
Date: 2010-10-12 11:39:47 -0400 (Tue, 12 Oct 2010)
New Revision: 18279

Modified:
   trunk/Open-ILS/src/c-apps/oils_sql.c
Log:
rearrangement for variable existance

Modified: trunk/Open-ILS/src/c-apps/oils_sql.c
===================================================================
--- trunk/Open-ILS/src/c-apps/oils_sql.c	2010-10-12 15:19:54 UTC (rev 18278)
+++ trunk/Open-ILS/src/c-apps/oils_sql.c	2010-10-12 15:39:47 UTC (rev 18279)
@@ -4788,24 +4788,11 @@
 			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 =
 			jsonObjectGetString( jsonObjectGetKeyConst( order_spec, "field" ));
 
-		// Add a separating comma, except at the beginning
-		if( first )
-			first = 0;
-		else
-			OSRF_BUFFER_ADD( order_buf, ", " );
-
 		if( !field || !class_alias ) {
 			osrfLogError( OSRF_LOG_MARK,
 				"%s: Missing class or field name in field specification of ORDER BY clause",
@@ -4822,6 +4809,19 @@
 			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;
+		}
+
+		// Add a separating comma, except at the beginning
+		if( first )
+			first = 0;
+		else
+			OSRF_BUFFER_ADD( order_buf, ", " );
+
 		osrfHash* field_def = osrfHashGet( order_class_info->fields, field );
 		if( !field_def ) {
 			osrfLogError( OSRF_LOG_MARK,



More information about the open-ils-commits mailing list