forked from madorin/fibplus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SIBAPI.pas
89 lines (70 loc) · 3.07 KB
/
SIBAPI.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
unit SIBAPI;
// SuperIB
// Copyright © 1999 David S. Becker
// dhbecker@jps.net
// www.jps.net/dhbecker/superib
{$I FIBPlus.inc}
interface
uses IB_Intf, SIBGlobals;
type
// data types used to interface with the InterBase API
SIB_PVoid = ^Pointer;
SIB_PPChar = ^PAnsiChar;
SIB_Long = LongInt;
SIB_PLong = ^SIB_Long;
SIB_UShort = Word;
SIB_DBHandle = SIB_PVoid;
SIB_PDBHandle = ^SIB_DBHandle;
SIB_Status = SIB_Long;
SIB_PStatus = ^SIB_Status;
SIB_PPStatus = ^SIB_PStatus;
SIB_StatusVector = array[0..19] of SIB_Status;
SIB_PStatusVector = ^SIB_StatusVector;
SIB_PPStatusVector = ^SIB_PStatusVector;
SIB_EventCallback = procedure(P: Pointer; Length: SIB_UShort; Updated: PAnsiChar); cdecl;
function SIB_Free(ClientLibrary:IIBClientLibrary;P: PAnsiChar): SIB_Long;
function SIB_QueEvents(ClientLibrary:IIBClientLibrary;Status: SIB_PStatusVector; DBHandle: SIB_PDBHandle; EventID: SIB_PLong;
Length: SIB_UShort;EventBuffer: PAnsiChar; Callback:
SIB_EventCallback; CallbackArg: Pointer
): SIB_Status;
function SIB_CancelEvents(ClientLibrary:IIBClientLibrary;Status: SIB_PStatusVector; DBHandle: SIB_DBHandle; EventID: SIB_PLong): SIB_Status;
procedure SIB_EventCounts(ClientLibrary:IIBClientLibrary;Status: SIB_PStatusVector; Length: SIB_UShort; EventBuffer, ResultBuffer: PAnsiChar);
implementation
uses IB_Externals, ibase;
//---------------------------------------------------------------------------
function SIB_QueEvents(ClientLibrary:IIBClientLibrary;Status: SIB_PStatusVector;
DBHandle: SIB_PDBHandle; EventID: SIB_PLong; Length: SIB_UShort;
EventBuffer: PAnsiChar; Callback: SIB_EventCallback; CallbackArg: Pointer): SIB_Status;
begin
with ClientLibrary do
Result := isc_que_events( PISC_STATUS( Status ), PISC_DB_HANDLE( DBHandle ),
PISC_LONG( EventID ),
Length, EventBuffer,
TISC_CALLBACK( Callback ), CallbackArg
);
Set8087CW(Default8087CW);
end;
//---------------------------------------------------------------------------
function SIB_CancelEvents(ClientLibrary:IIBClientLibrary;Status: SIB_PStatusVector; DBHandle: SIB_DBHandle; EventID: SIB_PLong): SIB_Status;
begin
with ClientLibrary do
Result := isc_cancel_events( PISC_STATUS( Status ), PISC_DB_HANDLE( DBHandle ), PISC_LONG( EventID ) );
Set8087CW(Default8087CW);
end;
//---------------------------------------------------------------------------
procedure SIB_EventCounts(ClientLibrary:IIBClientLibrary;Status: SIB_PStatusVector; Length: SIB_UShort; EventBuffer, ResultBuffer: PAnsiChar);
begin
ClientLibrary.isc_event_counts( PISC_STATUS( Status ), Length, EventBuffer, ResultBuffer );
Set8087CW(Default8087CW);
end;
//---------------------------------------------------------------------------
function SIB_Free(ClientLibrary:IIBClientLibrary;P: PAnsiChar): SIB_Long;
begin
with ClientLibrary do
if Assigned(P) then
Result := isc_free(P)
else
Result := 0 ;
Set8087CW(Default8087CW);
end;
end.