[open-ils-commits] r16199 - in trunk/Open-ILS: include/openils src/c-apps (scottmk)

svn at svn.open-ils.org svn at svn.open-ils.org
Mon Apr 12 09:07:57 EDT 2010


Author: scottmk
Date: 2010-04-12 09:07:56 -0400 (Mon, 12 Apr 2010)
New Revision: 16199

Modified:
   trunk/Open-ILS/include/openils/oils_sql.h
   trunk/Open-ILS/src/c-apps/oils_cstore.c
   trunk/Open-ILS/src/c-apps/oils_pcrud.c
   trunk/Open-ILS/src/c-apps/oils_rstore.c
   trunk/Open-ILS/src/c-apps/oils_sql.c
Log:
Restore the ability to set the maximum flesh depth by an entry
in the configuration file.  This ability was inadvertently
eliminated in the previous commit.

M    Open-ILS/include/openils/oils_sql.h
M    Open-ILS/src/c-apps/oils_pcrud.c
M    Open-ILS/src/c-apps/oils_rstore.c
M    Open-ILS/src/c-apps/oils_cstore.c
M    Open-ILS/src/c-apps/oils_sql.c


Modified: trunk/Open-ILS/include/openils/oils_sql.h
===================================================================
--- trunk/Open-ILS/include/openils/oils_sql.h	2010-04-12 12:52:34 UTC (rev 16198)
+++ trunk/Open-ILS/include/openils/oils_sql.h	2010-04-12 13:07:56 UTC (rev 16199)
@@ -26,7 +26,7 @@
 extern "C" {
 #endif
 
-void oilsSetSQLOptions( const char* module_name, int do_pcrud );
+void oilsSetSQLOptions( const char* module_name, int do_pcrud, int flesh_depth );
 void oilsSetDBConnection( dbi_conn conn );
 int oilsExtendIDL( void );
 int str_is_true( const char* str );

Modified: trunk/Open-ILS/src/c-apps/oils_cstore.c
===================================================================
--- trunk/Open-ILS/src/c-apps/oils_cstore.c	2010-04-12 12:52:34 UTC (rev 16198)
+++ trunk/Open-ILS/src/c-apps/oils_cstore.c	2010-04-12 13:07:56 UTC (rev 16199)
@@ -17,8 +17,6 @@
 static dbi_conn dbhandle; /* our CURRENT db connection */
 //static osrfHash * readHandles;
 
-static int max_flesh_depth = 100;
-
 static const int enforce_pcrud = 0;     // Boolean
 static const char modulename[] = "open-ils.cstore";
 
@@ -93,11 +91,21 @@
 	osrfLogInfo(OSRF_LOG_MARK, "Initializing the CStore Server...");
 	osrfLogInfo(OSRF_LOG_MARK, "Finding XML file...");
 
-	if (!oilsIDLInit( osrf_settings_host_value("/IDL") ))
+	if ( !oilsIDLInit( osrf_settings_host_value( "/IDL" )))
 		return 1; /* return non-zero to indicate error */
 
-	oilsSetSQLOptions( modulename, enforce_pcrud );
+	char* md = osrf_settings_host_value(
+		"/apps/%s/app_settings/max_query_recursion", modulename );
+	int max_flesh_depth = 100;
+	if( md )
+		max_flesh_depth = atoi( md );
+	if( max_flesh_depth < 0 )
+		max_flesh_depth = 1;
+	else if( max_flesh_depth > 1000 )
+		max_flesh_depth = 1000;
 
+	oilsSetSQLOptions( modulename, enforce_pcrud, max_flesh_depth );
+
 	growing_buffer* method_name = buffer_init(64);
 
 	// Generic search thingy
@@ -276,8 +284,6 @@
 	char* port   = osrf_settings_host_value("/apps/%s/app_settings/database/port", modulename );
 	char* db     = osrf_settings_host_value("/apps/%s/app_settings/database/db", modulename );
 	char* pw     = osrf_settings_host_value("/apps/%s/app_settings/database/pw", modulename );
-	char* md     = osrf_settings_host_value("/apps/%s/app_settings/max_query_recursion",
-			modulename );
 
 	osrfLogDebug(OSRF_LOG_MARK, "Attempting to load the database driver [%s]...", driver);
 	writehandle = dbi_conn_new(driver);
@@ -297,10 +303,6 @@
 	if(pw)   dbi_conn_set_option(writehandle, "password", pw );
 	if(db)   dbi_conn_set_option(writehandle, "dbname", db );
 
-	if(md)                     max_flesh_depth = atoi(md);
-	if(max_flesh_depth < 0)    max_flesh_depth = 1;
-	if(max_flesh_depth > 1000) max_flesh_depth = 1000;
-
 	free(user);
 	free(host);
 	free(port);

Modified: trunk/Open-ILS/src/c-apps/oils_pcrud.c
===================================================================
--- trunk/Open-ILS/src/c-apps/oils_pcrud.c	2010-04-12 12:52:34 UTC (rev 16198)
+++ trunk/Open-ILS/src/c-apps/oils_pcrud.c	2010-04-12 13:07:56 UTC (rev 16199)
@@ -20,8 +20,6 @@
 static dbi_conn dbhandle; /* our CURRENT db connection */
 //static osrfHash * readHandles;
 
-static int max_flesh_depth = 100;
-
 static const int enforce_pcrud = 1;     // Boolean
 static const char modulename[] = "open-ils.pcrud";
 
@@ -95,11 +93,21 @@
 	osrfLogInfo(OSRF_LOG_MARK, "Initializing the PCRUD Server...");
 	osrfLogInfo(OSRF_LOG_MARK, "Finding XML file...");
 
-	if (!oilsIDLInit( osrf_settings_host_value("/IDL") ))
+	if ( !oilsIDLInit( osrf_settings_host_value( "/IDL" )))
 		return 1; /* return non-zero to indicate error */
 
-	oilsSetSQLOptions( modulename, enforce_pcrud );
+	char* md = osrf_settings_host_value(
+		"/apps/%s/app_settings/max_query_recursion", modulename );
+	int max_flesh_depth = 100;
+	if( md )
+		max_flesh_depth = atoi( md );
+	if( max_flesh_depth < 0 )
+		max_flesh_depth = 1;
+	else if( max_flesh_depth > 1000 )
+		max_flesh_depth = 1000;
 
+	oilsSetSQLOptions( modulename, enforce_pcrud, max_flesh_depth );
+
 	growing_buffer* method_name = buffer_init(64);
 
 	// first we register all the transaction and savepoint methods
@@ -276,8 +284,6 @@
 	char* port   = osrf_settings_host_value("/apps/%s/app_settings/database/port", modulename );
 	char* db     = osrf_settings_host_value("/apps/%s/app_settings/database/db", modulename );
 	char* pw     = osrf_settings_host_value("/apps/%s/app_settings/database/pw", modulename );
-	char* md     = osrf_settings_host_value("/apps/%s/app_settings/max_query_recursion",
-			modulename );
 
 	osrfLogDebug(OSRF_LOG_MARK, "Attempting to load the database driver [%s]...", driver);
 	writehandle = dbi_conn_new(driver);
@@ -297,10 +303,6 @@
 	if(pw)   dbi_conn_set_option(writehandle, "password", pw );
 	if(db)   dbi_conn_set_option(writehandle, "dbname", db );
 
-	if(md)                     max_flesh_depth = atoi(md);
-	if(max_flesh_depth < 0)    max_flesh_depth = 1;
-	if(max_flesh_depth > 1000) max_flesh_depth = 1000;
-
 	free(user);
 	free(host);
 	free(port);

Modified: trunk/Open-ILS/src/c-apps/oils_rstore.c
===================================================================
--- trunk/Open-ILS/src/c-apps/oils_rstore.c	2010-04-12 12:52:34 UTC (rev 16198)
+++ trunk/Open-ILS/src/c-apps/oils_rstore.c	2010-04-12 13:07:56 UTC (rev 16199)
@@ -17,8 +17,6 @@
 static dbi_conn dbhandle; /* our CURRENT db connection */
 //static osrfHash * readHandles;
 
-static int max_flesh_depth = 100;
-
 static const int enforce_pcrud = 0;     // Boolean
 static const char modulename[] = "open-ils.reporter-store";
 
@@ -93,11 +91,21 @@
 	osrfLogInfo(OSRF_LOG_MARK, "Initializing the RStore Server...");
 	osrfLogInfo(OSRF_LOG_MARK, "Finding XML file...");
 
-	if (!oilsIDLInit( osrf_settings_host_value("/IDL") ))
+	if ( !oilsIDLInit( osrf_settings_host_value( "/IDL" )))
 		return 1; /* return non-zero to indicate error */
 
-	oilsSetSQLOptions( modulename, enforce_pcrud );
+	char* md = osrf_settings_host_value(
+		"/apps/%s/app_settings/max_query_recursion", modulename );
+	int max_flesh_depth = 100;
+	if( md )
+		max_flesh_depth = atoi( md );
+	if( max_flesh_depth < 0 )
+		max_flesh_depth = 1;
+	else if( max_flesh_depth > 1000 )
+		max_flesh_depth = 1000;
 
+	oilsSetSQLOptions( modulename, enforce_pcrud, max_flesh_depth );
+
 	growing_buffer* method_name = buffer_init(64);
 
 	// Generic search thingy
@@ -276,8 +284,6 @@
 	char* port   = osrf_settings_host_value("/apps/%s/app_settings/database/port", modulename );
 	char* db     = osrf_settings_host_value("/apps/%s/app_settings/database/db", modulename );
 	char* pw     = osrf_settings_host_value("/apps/%s/app_settings/database/pw", modulename );
-	char* md     = osrf_settings_host_value("/apps/%s/app_settings/max_query_recursion",
-			modulename );
 
 	osrfLogDebug(OSRF_LOG_MARK, "Attempting to load the database driver [%s]...", driver);
 	writehandle = dbi_conn_new(driver);
@@ -297,10 +303,6 @@
 	if(pw)   dbi_conn_set_option(writehandle, "password", pw );
 	if(db)   dbi_conn_set_option(writehandle, "dbname", db );
 
-	if(md)                     max_flesh_depth = atoi(md);
-	if(max_flesh_depth < 0)    max_flesh_depth = 1;
-	if(max_flesh_depth > 1000) max_flesh_depth = 1000;
-
 	free(user);
 	free(host);
 	free(port);

Modified: trunk/Open-ILS/src/c-apps/oils_sql.c
===================================================================
--- trunk/Open-ILS/src/c-apps/oils_sql.c	2010-04-12 12:52:34 UTC (rev 16198)
+++ trunk/Open-ILS/src/c-apps/oils_sql.c	2010-04-12 13:07:56 UTC (rev 16199)
@@ -153,7 +153,7 @@
 	Here we use the server name in messages to identify which kind of server issued them.
 	We use do_crud as a boolean to control whether or not to enforce the permissions scheme.
 */
-void oilsSetSQLOptions( const char* module_name, int do_pcrud ) {
+void oilsSetSQLOptions( const char* module_name, int do_pcrud, int flesh_depth ) {
 	if( !module_name )
 		module_name = "open-ils.cstore";   // bulletproofing with a default
 
@@ -161,8 +161,8 @@
 		free( modulename );
 
 	modulename = strdup( module_name );
-
 	enforce_pcrud = do_pcrud;
+	max_flesh_depth = flesh_depth;
 }
 
 /**



More information about the open-ils-commits mailing list