|
@@ -361,7 +361,8 @@ var
|
|
dbclose: procedure(dbproc:PDBPROCESS); cdecl;
|
|
dbclose: procedure(dbproc:PDBPROCESS); cdecl;
|
|
{$ENDIF}
|
|
{$ENDIF}
|
|
|
|
|
|
- DefaultDBLibLibraryName: String = DBLIBDLL;
|
|
|
|
|
|
+ DefaultDBLibLibraryName: string = DBLIBDLL;
|
|
|
|
+ DBLibLoadedLibrary: string = '';
|
|
{$ENDIF}
|
|
{$ENDIF}
|
|
|
|
|
|
{$IFDEF ntwdblib}
|
|
{$IFDEF ntwdblib}
|
|
@@ -378,7 +379,7 @@ procedure dbwinexit;
|
|
function dbsetlcharset(login:PLOGINREC; charset:PChar):RETCODE;
|
|
function dbsetlcharset(login:PLOGINREC; charset:PChar):RETCODE;
|
|
function dbsetlsecure(login:PLOGINREC):RETCODE;
|
|
function dbsetlsecure(login:PLOGINREC):RETCODE;
|
|
|
|
|
|
-procedure InitialiseDBLib(LibraryName : string = '');
|
|
|
|
|
|
+function InitialiseDBLib(const LibraryName : shortstring = ''): integer;
|
|
procedure ReleaseDBLib;
|
|
procedure ReleaseDBLib;
|
|
|
|
|
|
implementation
|
|
implementation
|
|
@@ -389,10 +390,11 @@ uses SysUtils, Dynlibs;
|
|
var DBLibLibraryHandle: TLibHandle;
|
|
var DBLibLibraryHandle: TLibHandle;
|
|
RefCount: integer;
|
|
RefCount: integer;
|
|
|
|
|
|
-procedure InitialiseDBLib(LibraryName : string);
|
|
|
|
|
|
+function InitialiseDBLib(const LibraryName : shortstring): integer;
|
|
var libname : string;
|
|
var libname : string;
|
|
begin
|
|
begin
|
|
inc(RefCount);
|
|
inc(RefCount);
|
|
|
|
+ Result:=RefCount;
|
|
if RefCount = 1 then
|
|
if RefCount = 1 then
|
|
begin
|
|
begin
|
|
if LibraryName='' then
|
|
if LibraryName='' then
|
|
@@ -406,6 +408,7 @@ begin
|
|
raise EInOutError.CreateFmt('Can not load DB-Lib client library "%s". Check your installation.'+LineEnding+'%s',
|
|
raise EInOutError.CreateFmt('Can not load DB-Lib client library "%s". Check your installation.'+LineEnding+'%s',
|
|
[libname, SysErrorMessage(GetLastOSError)]);
|
|
[libname, SysErrorMessage(GetLastOSError)]);
|
|
end;
|
|
end;
|
|
|
|
+ DBLibLoadedLibrary := libname;
|
|
|
|
|
|
pointer(dbinit) := GetProcedureAddress(DBLibLibraryHandle,'dbinit');
|
|
pointer(dbinit) := GetProcedureAddress(DBLibLibraryHandle,'dbinit');
|
|
pointer(dblogin) := GetProcedureAddress(DBLibLibraryHandle,'dblogin');
|
|
pointer(dblogin) := GetProcedureAddress(DBLibLibraryHandle,'dblogin');
|
|
@@ -463,7 +466,10 @@ begin
|
|
begin
|
|
begin
|
|
dbexit;{$IFDEF WINDOWS}dbwinexit;{$ENDIF}
|
|
dbexit;{$IFDEF WINDOWS}dbwinexit;{$ENDIF}
|
|
if UnloadLibrary(DBLibLibraryHandle) then
|
|
if UnloadLibrary(DBLibLibraryHandle) then
|
|
- DBLibLibraryHandle := NilHandle
|
|
|
|
|
|
+ begin
|
|
|
|
+ DBLibLibraryHandle := NilHandle;
|
|
|
|
+ DBLibLoadedLibrary := '';
|
|
|
|
+ end
|
|
else
|
|
else
|
|
inc(RefCount);
|
|
inc(RefCount);
|
|
end;
|
|
end;
|