[open-ils-commits] r16115 - trunk/Open-ILS/src/c-apps (scottmk)
svn at svn.open-ils.org
svn at svn.open-ils.org
Sat Apr 3 01:48:43 EDT 2010
Author: scottmk
Date: 2010-04-03 01:48:39 -0400 (Sat, 03 Apr 2010)
New Revision: 16115
Modified:
trunk/Open-ILS/src/c-apps/oils_cstore.c
Log:
Create a separate function for adding datatype information
from the database to the IDL information. That way we can
call it in other contexts, e.g. the forthcoming
query set server.
M Open-ILS/src/c-apps/oils_cstore.c
Modified: trunk/Open-ILS/src/c-apps/oils_cstore.c
===================================================================
--- trunk/Open-ILS/src/c-apps/oils_cstore.c 2010-04-03 03:16:35 UTC (rev 16114)
+++ trunk/Open-ILS/src/c-apps/oils_cstore.c 2010-04-03 05:48:39 UTC (rev 16115)
@@ -157,9 +157,6 @@
static char* org_tree_root( osrfMethodContext* ctx );
static jsonObject* single_hash( const char* key, const char* value );
-static const int enforce_pcrud = ENFORCE_PCRUD; // Boolean
-static const char modulename[] = MODULENAME;
-
static int child_initialized = 0; /* boolean */
static dbi_conn writehandle; /* our MASTER db connection */
@@ -172,6 +169,18 @@
// confusing because the top level of the query is at the bottom of the stack.
static QueryFrame* curr_query = NULL;
+//----------------------------------
+
+int oilsExtendIDL( void );
+
+static dbi_conn writehandle; /* our MASTER db connection */
+static dbi_conn dbhandle; /* our CURRENT db connection */
+//static osrfHash * readHandles;
+
+static const int enforce_pcrud = ENFORCE_PCRUD; // Boolean
+static const char modulename[] = MODULENAME;
+
+
/**
@brief Disconnect from the database.
@@ -540,6 +549,26 @@
osrfLogInfo(OSRF_LOG_MARK, "%s successfully connected to the database", modulename );
+ // Add datatypes from database to the fields in the IDL
+ if( oilsExtendIDL() ) {
+ osrfLogError( OSRF_LOG_MARK, "Error extending the IDL" );
+ return -1;
+ }
+ else
+ return 0;
+}
+
+/**
+ @brief Add datatypes from the database to the fields in the IDL.
+ @return Zero if successful, or 1 upon error.
+
+ For each relevant class in the IDL: ask the database for the datatype of every field.
+ In particular, determine which fields are text fields and which fields are numeric
+ fields, so that we know whether to enclose their values in quotes.
+
+ At this writing this function does not detect any errors, so it always returns zero.
+*/
+int oilsExtendIDL( void ) {
osrfHashIterator* class_itr = osrfNewHashIterator( oilsIDL() );
osrfHash* class = NULL;
growing_buffer* query_buf = buffer_init( 64 );
More information about the open-ils-commits
mailing list