mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-20 11:09:42 +02:00
* postgres initialize routine gets dll path as parameter. Default parameter to old value for compat.
Mantis 17902. git-svn-id: trunk@17739 -
This commit is contained in:
parent
de266c9857
commit
f0bb0cbeed
@ -43,7 +43,7 @@ var
|
||||
{ Macro translated }
|
||||
Function DLE_VAL(elem : PDlelem) : pointer;
|
||||
|
||||
Procedure InitialiseDllist;
|
||||
Procedure InitialiseDllist(libpath:string=pqlib);
|
||||
Procedure ReleaseDllist;
|
||||
|
||||
var DllistLibraryHandle : TLibHandle;
|
||||
@ -52,17 +52,17 @@ implementation
|
||||
|
||||
var RefCount : integer;
|
||||
|
||||
Procedure InitialiseDllist;
|
||||
Procedure InitialiseDllist(libpath:string=pqlib);
|
||||
|
||||
begin
|
||||
inc(RefCount);
|
||||
if RefCount = 1 then
|
||||
begin
|
||||
DllistLibraryHandle := loadlibrary(pqlib);
|
||||
DllistLibraryHandle := loadlibrary(libpath);
|
||||
if DllistLibraryHandle = nilhandle then
|
||||
begin
|
||||
RefCount := 0;
|
||||
Raise EInOutError.Create('Can not load PosgreSQL client. Is it installed? ('+pqlib+')');
|
||||
Raise EInOutError.Create('Can not load PosgreSQL client. Is it installed? ('+libpath+')');
|
||||
end;
|
||||
|
||||
pointer(DLNewList) := GetProcedureAddress(DllistLibraryHandle,'DLNewList');
|
||||
|
@ -209,7 +209,7 @@ var
|
||||
{ Get encoding id from environment variable PGCLIENTENCODING }
|
||||
PQenv2encoding: function :longint;cdecl;
|
||||
|
||||
Procedure InitialisePostgres3;
|
||||
Procedure InitialisePostgres3(libpath:string=pqlib);
|
||||
Procedure ReleasePostgres3;
|
||||
|
||||
function PQsetdb(M_PGHOST,M_PGPORT,M_PGOPT,M_PGTTY,M_DBNAME : pchar) : ppgconn;
|
||||
@ -220,17 +220,17 @@ implementation
|
||||
|
||||
var RefCount : integer;
|
||||
|
||||
Procedure InitialisePostgres3;
|
||||
Procedure InitialisePostgres3(libpath:string=pqlib);
|
||||
|
||||
begin
|
||||
inc(RefCount);
|
||||
if RefCount = 1 then
|
||||
begin
|
||||
Postgres3LibraryHandle := loadlibrary(pqlib);
|
||||
Postgres3LibraryHandle := loadlibrary(libpath);
|
||||
if Postgres3LibraryHandle = nilhandle then
|
||||
begin
|
||||
RefCount := 0;
|
||||
Raise EInOutError.Create('Can not load PosgreSQL client. Is it installed? ('+pqlib+')');
|
||||
Raise EInOutError.Create('Can not load PosgreSQL client. Is it installed? ('+libpath+')');
|
||||
end;
|
||||
|
||||
pointer(PQconnectStart) := GetProcedureAddress(Postgres3LibraryHandle,'PQconnectStart');
|
||||
|
Loading…
Reference in New Issue
Block a user