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
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()");