Browse Source

* Patch from LaCo to bring implementation in line with other DB dyn units (bug ID 25118)

git-svn-id: trunk@25732 -
michael 11 years ago
parent
commit
86d2d0c9be
1 changed files with 9 additions and 8 deletions
  1. 9 8
      packages/oracle/src/oci.inc

+ 9 - 8
packages/oracle/src/oci.inc

@@ -3378,10 +3378,11 @@ uses ctypes,
 {$include ociap.inc}
 {$include ociap.inc}
 
 
 {$IFDEF LinkDynamically}
 {$IFDEF LinkDynamically}
-Procedure InitialiseOCI(LibraryName: AnsiString = ocilib);
+Function InitialiseOCI(const LibraryName: AnsiString = ocilib): integer;
 Procedure ReleaseOCI;
 Procedure ReleaseOCI;
 
 
 var OCILibraryHandle : TLibHandle;
 var OCILibraryHandle : TLibHandle;
+    OCILoadedLibrary : AnsiString;
 {$ENDIF}
 {$ENDIF}
 
 
 implementation
 implementation
@@ -3392,16 +3393,16 @@ implementation
 
 
 var 
 var 
   RefCount : integer;
   RefCount : integer;
-  LibName : AnsiString;
-  
-Procedure InitialiseOCI(LibraryName: AnsiString = ocilib);
+
+function InitialiseOCI(const LibraryName: AnsiString = ocilib): integer;
 
 
 begin
 begin
   inc(RefCount);
   inc(RefCount);
+  Result:=RefCount;
   if RefCount > 1 then
   if RefCount > 1 then
     begin
     begin
-    if CompareText(LibName,LibraryName)<>0 then
-      Raise EInOutError.CreateFmt('Can not load Oracle client library "%s". it is already loaded as "%s".',[LibraryName,LibName]);
+    if CompareText(OCILoadedLibrary,LibraryName)<>0 then
+      Raise EInOutError.CreateFmt('Can not load Oracle client library "%s". it is already loaded as "%s".',[LibraryName,OCILoadedLibrary]);
     exit; 
     exit; 
     end
     end
   else
   else
@@ -3412,7 +3413,7 @@ begin
       RefCount := 0;
       RefCount := 0;
       Raise EInOutError.CreateFmt('Can not load Oracle client library "%s". Is it installed?',[LibraryName]);
       Raise EInOutError.CreateFmt('Can not load Oracle client library "%s". Is it installed?',[LibraryName]);
       end;
       end;
-    libName:=LibraryName;
+    OCILoadedLibrary:=LibraryName;
     end;  
     end;  
     
     
 { ORL.inc}
 { ORL.inc}
@@ -3912,7 +3913,7 @@ begin
     begin
     begin
     if not UnloadLibrary(OCILibraryHandle) then 
     if not UnloadLibrary(OCILibraryHandle) then 
       inc(RefCount);
       inc(RefCount);
-    LibName:='';
+    OCILoadedLibrary:='';
     end;
     end;
 end;
 end;