|
@@ -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;
|
|
|
|
|