]> err.no Git - sope/commitdiff
applied Ludovics patch
authorhelge <helge@e4a50df8-12e2-0310-a44c-efbce7f8a7e3>
Thu, 15 Nov 2007 11:17:01 +0000 (11:17 +0000)
committerhelge <helge@e4a50df8-12e2-0310-a44c-efbce7f8a7e3>
Thu, 15 Nov 2007 11:17:01 +0000 (11:17 +0000)
git-svn-id: http://svn.opengroupware.org/SOPE/trunk@1547 e4a50df8-12e2-0310-a44c-efbce7f8a7e3

sope-gdl1/Oracle8/ChangeLog
sope-gdl1/Oracle8/GNUmakefile
sope-gdl1/Oracle8/OracleAdaptorChannel.m
sope-gdl1/Oracle8/OracleAdaptorChannelController.m

index 40f031a52bf91704ecae9fe7c1820d3c0913488e..b04382763497addab6bc56e532f99a952fb85fe3 100644 (file)
@@ -1,3 +1,7 @@
+2007-11-15  Ludovic Marcotte <ludovic@inverse.ca>
+
+       * fixes
+
 2007-10-19  Ludovic Marcotte <ludovic@inverse.ca>
 
        * We call OCITerminate() in OracleAdaptorChannel:
index 496d732e2dd5177e24eec33810224071203e2897..b60271cb7c12218dccf10bb0e082fd32895d2964 100644 (file)
@@ -28,15 +28,23 @@ include ./Version
 SOPE_ROOT=../..
 ORACLE_VERSION=10.2.0.3
 #ORACLE_VERSION=11.1.0.1
-ADDITIONAL_INCLUDE_DIRS += -I../GDLAccess -I.. -I/usr/include/oracle/$(ORACLE_VERSION)/client
+ADDITIONAL_INCLUDE_DIRS += -I../../sope-core -I../../sope-core/NGExtensions -I../GDLAccess -I.. -I/usr/include/oracle/$(ORACLE_VERSION)/client
+
+local_arch = $(subst 64,,$(shell uname -m))
+
+ifeq ($(local_arch),ppc)
+PPC_LDFLAGS=-L/opt/ibmcmp/lib -libmc++
+else
+PPC_LDFLAGS=
+endif
 
 ifneq ($(frameworks),yes)
-Oracle8_BUNDLE_LIBS += -L/usr/lib/oracle/$(ORACLE_VERSION)/client/lib/ -locci -lociei -lclntsh -lnnz10 -lGDLAccess -lEOControl
-otest_TOOL_LIBS   += -L/usr/lib/oracle/$(ORACLE_VERSION)/client/lib/ -locci -lociei -lclntsh -lnnz10 -lGDLAccess -lEOControl
+common_LIBS = -L/usr/lib/oracle/$(ORACLE_VERSION)/client/lib/ -locci -lociei -lclntsh -lnnz10 -L../GDLAccess/obj -lGDLAccess -L../../sope-core/EOControl/obj -lEOControl $(PPC_LDFLAGS)
 else
-Oracle8_BUNDLE_LIBS += -L/usr/lib/oracle/$(ORACLE_VERSION)/client/lib/ -locci -lociei -lclntsh -lnnz10 -framework GDLAccess -framework EOControl
-otest_TOOL_LIBS   += -L/usr/lib/oracle/$(ORACLE_VERSION)/client/lib/ -locci -lociei -lclntsh -lnnz10 -framework GDLAccess -framework EOControl
+common_LIBS = -L/usr/lib/oracle/$(ORACLE_VERSION)/client/lib/ -locci -lociei -lclntsh -lnnz10 -framework GDLAccess -framework EOControl $(PPC_LDFLAGS)
 endif
+Oracle8_BUNDLE_LIBS += $(common_LIBS)
+otest_TOOL_LIBS   += $(common_LIBS)
 
 # Bundle
 BUNDLE_NAME = Oracle8
index bf090d1f7d0920c87c6fac8eb82ab758f66fefbf..e632347704a942c9fa6d5cff9cf071ee5ed9be73 100644 (file)
   while (c--)
     {
       info = [[_row_buffer objectAtIndex: c] pointerValue];
-      [_row_buffer removeObjectAtIndex: c];
 
       // We free our LOB object. If it fails, it likely mean it isn't a LOB
       // so we just free the value instead.
-      if (OCIDescriptorFree((dvoid *)info->value, (ub4)OCI_DTYPE_LOB) != OCI_SUCCESS)
-       {
-         free(info->value);
-       }
+      if (info->value)
+       {
+         if (OCIDescriptorFree((dvoid *)info->value, (ub4)OCI_DTYPE_LOB) != OCI_SUCCESS)
+           free(info->value);
+         info->value = NULL;
+       }
+       free(info);
+      [_row_buffer removeObjectAtIndex: c];
     }
 
   OCIHandleFree(_current_stm, OCI_HTYPE_STMT);
 //
 @implementation OracleAdaptorChannel
 
+static void
+DBTerminate()
+{
+  if (OCITerminate(OCI_DEFAULT))
+    NSLog(@"FAILED: OCITerminate()");
+  else
+    NSLog(@"Oracle8: environment shut down");
+}
+
++ (void) initialize
+{
+  // We Initialize the OCI process environment.
+  if (OCIInitialize((ub4)OCI_DEFAULT, (dvoid *)0,
+                    (dvoid * (*)(dvoid *, size_t)) 0,
+                    (dvoid * (*)(dvoid *, dvoid *, size_t))0,
+                    (void (*)(dvoid *, dvoid *)) 0 ))
+    NSLog(@"FAILED: OCIInitialize()");
+  else
+    {
+      NSLog(@"Oracle8: environment initialized");
+      atexit(DBTerminate);
+    }
+}
+
 - (id) initWithAdaptorContext: (EOAdaptorContext *) theAdaptorContext
 {
   if ((self = [super initWithAdaptorContext: theAdaptorContext]))
          NSLog(@"FAILED: OCILogoff()");
        }
 
-      if (OCITerminate(OCI_DEFAULT))
-       {
-         NSLog(@"FAILED: OCITerminate()");
-       }
+
+      OCIHandleFree(_oci_ctx, OCI_HTYPE_SVCCTX);
+      OCIHandleFree(_oci_err, OCI_HTYPE_ERROR);
+      // OCIHandleFree(_oci_env, OCI_HTYPE_ENV);
+
+      _oci_ctx = (OCISvcCtx *)0;
+      _oci_err = (OCIError *)0;
+      _oci_env = (OCIEnv *)0;
     }
 }
 
   [self _cleanup];
 
   RELEASE(_resultSetProperties);
-
-  OCIHandleFree(_oci_ctx, OCI_HTYPE_SVCCTX);
-  OCIHandleFree(_oci_err, OCI_HTYPE_ERROR);
-  OCIHandleFree(_oci_env, OCI_HTYPE_ENV);
-
   RELEASE(delegate);
 
   [super dealloc];
       return NO;
     }
 
-  // We Initialize the OCI process environment.
-  if (OCIInitialize((ub4)OCI_DEFAULT, (dvoid *)0,
-                    (dvoid * (*)(dvoid *, size_t)) 0,
-                    (dvoid * (*)(dvoid *, dvoid *, size_t))0,
-                    (void (*)(dvoid *, dvoid *)) 0 ))
-    {
-      NSLog(@"FAILED: OCIInitialize()");
-      return NO;
-    }
-  
   if (OCIEnvInit((OCIEnv **)&_oci_env, (ub4)OCI_DEFAULT, (size_t)0, (dvoid **)0))
     {
       NSLog(@"FAILED: OCIEnvInit()");
index 7f0ec89f59df82f3acc5d74daa7e0ac2285ab33d..964fbd2ecaeef5c695263658a826f98b602b29c1 100644 (file)
          OCILobFreeTemporary([theChannel serviceContext], [theChannel errorHandle], info->value);
          OCIDescriptorFree((dvoid *)info->value, (ub4)OCI_DTYPE_LOB);
        }
+      free(info);
     }
+  [theColumns release];
 
   OCIHandleFree(theStatement, OCI_HTYPE_STMT);
 }