mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-17 02:59:13 +02:00
* Patch from LaCo to bring implementation in line with other DB dyn units (bug ID 25118)
git-svn-id: trunk@25732 -
This commit is contained in:
parent
b73252bd3d
commit
86d2d0c9be
@ -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;
|
|
||||||
|
function InitialiseOCI(const LibraryName: AnsiString = ocilib): integer;
|
||||||
Procedure InitialiseOCI(LibraryName: AnsiString = ocilib);
|
|
||||||
|
|
||||||
begin
|
begin
|
||||||
inc(RefCount);
|
inc(RefCount);
|
||||||
|
Result:=RefCount;
|
||||||
if RefCount > 1 then
|
if RefCount > 1 then
|
||||||
begin
|
begin
|
||||||
if CompareText(LibName,LibraryName)<>0 then
|
if CompareText(OCILoadedLibrary,LibraryName)<>0 then
|
||||||
Raise EInOutError.CreateFmt('Can not load Oracle client library "%s". it is already loaded as "%s".',[LibraryName,LibName]);
|
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;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user