mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-10 15:05:58 +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 }
|
{ Macro translated }
|
||||||
Function DLE_VAL(elem : PDlelem) : pointer;
|
Function DLE_VAL(elem : PDlelem) : pointer;
|
||||||
|
|
||||||
Procedure InitialiseDllist;
|
Procedure InitialiseDllist(libpath:string=pqlib);
|
||||||
Procedure ReleaseDllist;
|
Procedure ReleaseDllist;
|
||||||
|
|
||||||
var DllistLibraryHandle : TLibHandle;
|
var DllistLibraryHandle : TLibHandle;
|
||||||
@ -52,17 +52,17 @@ implementation
|
|||||||
|
|
||||||
var RefCount : integer;
|
var RefCount : integer;
|
||||||
|
|
||||||
Procedure InitialiseDllist;
|
Procedure InitialiseDllist(libpath:string=pqlib);
|
||||||
|
|
||||||
begin
|
begin
|
||||||
inc(RefCount);
|
inc(RefCount);
|
||||||
if RefCount = 1 then
|
if RefCount = 1 then
|
||||||
begin
|
begin
|
||||||
DllistLibraryHandle := loadlibrary(pqlib);
|
DllistLibraryHandle := loadlibrary(libpath);
|
||||||
if DllistLibraryHandle = nilhandle then
|
if DllistLibraryHandle = nilhandle then
|
||||||
begin
|
begin
|
||||||
RefCount := 0;
|
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;
|
end;
|
||||||
|
|
||||||
pointer(DLNewList) := GetProcedureAddress(DllistLibraryHandle,'DLNewList');
|
pointer(DLNewList) := GetProcedureAddress(DllistLibraryHandle,'DLNewList');
|
||||||
|
@ -209,7 +209,7 @@ var
|
|||||||
{ Get encoding id from environment variable PGCLIENTENCODING }
|
{ Get encoding id from environment variable PGCLIENTENCODING }
|
||||||
PQenv2encoding: function :longint;cdecl;
|
PQenv2encoding: function :longint;cdecl;
|
||||||
|
|
||||||
Procedure InitialisePostgres3;
|
Procedure InitialisePostgres3(libpath:string=pqlib);
|
||||||
Procedure ReleasePostgres3;
|
Procedure ReleasePostgres3;
|
||||||
|
|
||||||
function PQsetdb(M_PGHOST,M_PGPORT,M_PGOPT,M_PGTTY,M_DBNAME : pchar) : ppgconn;
|
function PQsetdb(M_PGHOST,M_PGPORT,M_PGOPT,M_PGTTY,M_DBNAME : pchar) : ppgconn;
|
||||||
@ -220,17 +220,17 @@ implementation
|
|||||||
|
|
||||||
var RefCount : integer;
|
var RefCount : integer;
|
||||||
|
|
||||||
Procedure InitialisePostgres3;
|
Procedure InitialisePostgres3(libpath:string=pqlib);
|
||||||
|
|
||||||
begin
|
begin
|
||||||
inc(RefCount);
|
inc(RefCount);
|
||||||
if RefCount = 1 then
|
if RefCount = 1 then
|
||||||
begin
|
begin
|
||||||
Postgres3LibraryHandle := loadlibrary(pqlib);
|
Postgres3LibraryHandle := loadlibrary(libpath);
|
||||||
if Postgres3LibraryHandle = nilhandle then
|
if Postgres3LibraryHandle = nilhandle then
|
||||||
begin
|
begin
|
||||||
RefCount := 0;
|
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;
|
end;
|
||||||
|
|
||||||
pointer(PQconnectStart) := GetProcedureAddress(Postgres3LibraryHandle,'PQconnectStart');
|
pointer(PQconnectStart) := GetProcedureAddress(Postgres3LibraryHandle,'PQconnectStart');
|
||||||
|
Loading…
Reference in New Issue
Block a user