📄 zlibpgsql.pas
字号:
TPQbinaryTuples = function(Result: PPGresult): Integer; cdecl;
TPQfname = function(Result: PPGresult; field_num: Integer): PChar; cdecl;
TPQfnumber = function(Result: PPGresult; field_name: PChar): Integer; cdecl;
TPQftype = function(Result: PPGresult; field_num: Integer): Oid; cdecl;
TPQfsize = function(Result: PPGresult; field_num: Integer): Integer; cdecl;
TPQfmod = function(Result: PPGresult; field_num: Integer): Integer; cdecl;
TPQcmdStatus = function(Result: PPGresult): PChar; cdecl;
TPQoidValue = function(Result: PPGresult): Oid; cdecl;
TPQoidStatus = function(Result: PPGresult): PChar; cdecl;
TPQcmdTuples = function(Result: PPGresult): PChar; cdecl;
TPQgetvalue = function(Result: PPGresult; tup_num, field_num: Integer): PChar; cdecl;
TPQgetlength = function(Result: PPGresult; tup_num, field_num: Integer): Integer; cdecl;
TPQgetisnull = function(Result: PPGresult; tup_num, field_num: Integer): Integer; cdecl;
TPQclear = procedure(Result: PPGresult); cdecl;
TPQmakeEmptyPGresult = function(Handle: PPGconn; status: ExecStatusType): PPGresult; cdecl;
{ === in fe-lobj.c === }
Tlo_open = function(Handle: PPGconn; lobjId: Oid; mode: Integer): Integer; cdecl;
Tlo_close = function(Handle: PPGconn; fd: Integer): Integer; cdecl;
Tlo_read = function(Handle: PPGconn; fd: Integer; buf: PChar; len: Integer): Integer; cdecl;
Tlo_write = function(Handle: PPGconn; fd: Integer; buf: PChar; len: Integer): Integer; cdecl;
Tlo_lseek = function(Handle: PPGconn; fd, offset, whence: Integer): Integer; cdecl;
Tlo_creat = function(Handle: PPGconn; mode: Integer): Oid; cdecl;
Tlo_tell = function(Handle: PPGconn; fd: Integer): Integer; cdecl;
Tlo_unlink = function(Handle: PPGconn; lobjId: Oid): Integer; cdecl;
Tlo_import = function(Handle: PPGconn; filename: PChar): Oid; cdecl;
Tlo_export = function(Handle: PPGconn; lobjId: Oid; filename: PChar): Integer; cdecl;
{************* Plain API Function variables definition ************}
var
{ === in fe-connect.c === }
PQconnectdb: TPQconnectdb;
PQsetdbLogin: TPQsetdbLogin;
PQconndefaults: TPQconndefaults;
PQfinish: TPQfinish;
PQreset: TPQreset;
PQrequestCancel: TPQrequestCancel;
PQdb: TPQdb;
PQuser: TPQuser;
PQpass: TPQpass;
PQhost: TPQhost;
PQport: TPQport;
PQtty: TPQtty;
PQoptions: TPQoptions;
PQstatus: TPQstatus;
PQerrorMessage: TPQerrorMessage;
PQsocket: TPQsocket;
PQbackendPID: TPQbackendPID;
PQtrace: TPQtrace;
PQuntrace: TPQuntrace;
PQsetNoticeProcessor: TPQsetNoticeProcessor;
{ === in fe-exec.c === }
PQexec: TPQexec;
PQnotifies: TPQnotifies;
PQnotifyFree: TPQnotifyFree;
PQsendQuery: TPQsendQuery;
PQgetResult: TPQgetResult;
PQisBusy: TPQisBusy;
PQconsumeInput: TPQconsumeInput;
PQgetline: TPQgetline;
PQputline: TPQputline;
PQgetlineAsync: TPQgetlineAsync;
PQputnbytes: TPQputnbytes;
PQendcopy: TPQendcopy;
PQfn: TPQfn;
PQresultStatus: TPQresultStatus;
PQresultErrorMessage: TPQresultErrorMessage;
PQntuples: TPQntuples;
PQnfields: TPQnfields;
PQbinaryTuples: TPQbinaryTuples;
PQfname: TPQfname;
PQfnumber: TPQfnumber;
PQftype: TPQftype;
PQfsize: TPQfsize;
PQfmod: TPQfmod;
PQcmdStatus: TPQcmdStatus;
PQoidValue: TPQoidValue;
PQoidStatus: TPQoidStatus;
PQcmdTuples: TPQcmdTuples;
PQgetvalue: TPQgetvalue;
PQgetlength: TPQgetlength;
PQgetisnull: TPQgetisnull;
PQclear: TPQclear;
PQmakeEmptyPGresult: TPQmakeEmptyPGresult;
{ === in fe-lobj.c === }
lo_open: Tlo_open;
lo_close: Tlo_close;
lo_read: Tlo_read;
lo_write: Tlo_write;
lo_lseek: Tlo_lseek;
lo_creat: Tlo_creat;
lo_tell: Tlo_tell;
lo_unlink: Tlo_unlink;
lo_import: Tlo_import;
lo_export: Tlo_export;
function PgSqlLoadLib: Boolean;
const
DLL: string = DEFAULT_DLL_LOCATION;
hDLL: THandle = 0;
LibLoaded: Boolean = False;
implementation
uses SysUtils, ZDBaseConst;
{ Initialize PostgreSQL dynamic library }
function PgSqlLoadLib: Boolean;
begin
if hDLL = 0 then
begin
hDLL := GetModuleHandle(PChar(DLL));
LibLoaded := False;
if hDLL = 0 then
begin
hDLL := LoadLibrary(PChar(DLL));
LibLoaded := True;
end;
end;
if hDLL <> 0 then
begin
{ === in fe-connect.c === }
@PQconnectdb := GetProcAddress(hDLL,'PQconnectdb');
@PQsetdbLogin := GetProcAddress(hDLL,'PQsetdbLogin');
@PQconndefaults := GetProcAddress(hDLL,'PQconndefaults');
@PQfinish := GetProcAddress(hDLL,'PQfinish');
@PQreset := GetProcAddress(hDLL,'PQreset');
@PQrequestCancel := GetProcAddress(hDLL,'PQrequestCancel');
@PQdb := GetProcAddress(hDLL,'PQdb');
@PQuser := GetProcAddress(hDLL,'PQuser');
@PQpass := GetProcAddress(hDLL,'PQpass');
@PQhost := GetProcAddress(hDLL,'PQhost');
@PQport := GetProcAddress(hDLL,'PQport');
@PQtty := GetProcAddress(hDLL,'PQtty');
@PQoptions := GetProcAddress(hDLL,'PQoptions');
@PQstatus := GetProcAddress(hDLL,'PQstatus');
@PQerrorMessage := GetProcAddress(hDLL,'PQerrorMessage');
@PQsocket := GetProcAddress(hDLL,'PQsocket');
@PQbackendPID := GetProcAddress(hDLL,'PQbackendPID');
@PQtrace := GetProcAddress(hDLL,'PQtrace');
@PQuntrace := GetProcAddress(hDLL,'PQuntrace');
@PQsetNoticeProcessor := GetProcAddress(hDLL,'PQsetNoticeProcessor');
{ === in fe-exec.c === }
@PQexec := GetProcAddress(hDLL,'PQexec');
@PQnotifies := GetProcAddress(hDLL,'PQnotifies');
@PQnotifyFree := GetProcAddress(hDLL,'PQnotifyFree');
@PQsendQuery := GetProcAddress(hDLL,'PQsendQuery');
@PQgetResult := GetProcAddress(hDLL,'PQgetResult');
@PQisBusy := GetProcAddress(hDLL,'PQisBusy');
@PQconsumeInput := GetProcAddress(hDLL,'PQconsumeInput');
@PQgetline := GetProcAddress(hDLL,'PQgetline');
@PQputline := GetProcAddress(hDLL,'PQputline');
@PQgetlineAsync := GetProcAddress(hDLL,'PQgetlineAsync');
@PQputnbytes := GetProcAddress(hDLL,'PQputnbytes');
@PQendcopy := GetProcAddress(hDLL,'PQendcopy');
@PQfn := GetProcAddress(hDLL,'PQfn');
@PQresultStatus := GetProcAddress(hDLL,'PQresultStatus');
@PQresultErrorMessage := GetProcAddress(hDLL,'PQresultErrorMessage');
@PQntuples := GetProcAddress(hDLL,'PQntuples');
@PQnfields := GetProcAddress(hDLL,'PQnfields');
@PQbinaryTuples := GetProcAddress(hDLL,'PQbinaryTuples');
@PQfname := GetProcAddress(hDLL,'PQfname');
@PQfnumber := GetProcAddress(hDLL,'PQfnumber');
@PQftype := GetProcAddress(hDLL,'PQftype');
@PQfsize := GetProcAddress(hDLL,'PQfsize');
@PQfmod := GetProcAddress(hDLL,'PQfmod');
@PQcmdStatus := GetProcAddress(hDLL,'PQcmdStatus');
@PQoidValue := GetProcAddress(hDLL,'PQoidValue');
@PQoidStatus := GetProcAddress(hDLL,'PQoidStatus');
@PQcmdTuples := GetProcAddress(hDLL,'PQcmdTuples');
@PQgetvalue := GetProcAddress(hDLL,'PQgetvalue');
@PQgetlength := GetProcAddress(hDLL,'PQgetlength');
@PQgetisnull := GetProcAddress(hDLL,'PQgetisnull');
@PQclear := GetProcAddress(hDLL,'PQclear');
@PQmakeEmptyPGresult := GetProcAddress(hDLL,'PQmakeEmptyPGresult');
{ === in fe-lobj.c === }
@lo_open := GetProcAddress(hDLL,'lo_open');
@lo_close := GetProcAddress(hDLL,'lo_close');
@lo_read := GetProcAddress(hDLL,'lo_read');
@lo_write := GetProcAddress(hDLL,'lo_write');
@lo_lseek := GetProcAddress(hDLL,'lo_lseek');
@lo_creat := GetProcAddress(hDLL,'lo_creat');
@lo_tell := GetProcAddress(hDLL,'lo_tell');
@lo_unlink := GetProcAddress(hDLL,'lo_unlink');
@lo_import := GetProcAddress(hDLL,'lo_import');
@lo_export := GetProcAddress(hDLL,'lo_export');
Result := True;
end else
raise Exception.Create(Format(SLibraryNotFound,[DLL]));
end;
initialization
finalization
if (hDLL <> 0) and LibLoaded then
FreeLibrary(hDLL);
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -