ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/public/ibx/branches/udr/udr/source/FBUDRIntf.pas
Revision: 373
Committed: Thu Jan 6 14:14:57 2022 UTC (2 years, 2 months ago) by tony
Content type: text/x-pascal
File size: 7608 byte(s)
Log Message:
Fixes Merged

File Contents

# Content
1 (*
2 * Firebird UDR Support (fbudr). The fbudr components provide a set of
3 * Pascal language bindings for the Firebird API in support of server
4 * side User Defined Routines (UDRs). The fbudr package is an extension
5 * to the Firebird Pascal API.
6 *
7 * The contents of this file are subject to the Initial Developer's
8 * Public License Version 1.0 (the "License"); you may not use this
9 * file except in compliance with the License. You may obtain a copy
10 * of the License here:
11 *
12 * http://www.firebirdsql.org/index.php?op=doc&id=idpl
13 *
14 * Software distributed under the License is distributed on an "AS
15 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
16 * implied. See the License for the specific language governing rights
17 * and limitations under the License.
18 *
19 * The Initial Developer of the Original Code is Tony Whyman.
20 *
21 * The Original Code is (C) 2021 Tony Whyman, MWA Software
22 * (http://www.mwasoftware.co.uk).
23 *
24 * All Rights Reserved.
25 *
26 * Contributor(s): ______________________________________.
27 *
28 *)
29 unit FBUDRIntf;
30
31 {$IFDEF MSWINDOWS}
32 {$DEFINE WINDOWS}
33 {$ENDIF}
34
35 {$IFDEF FPC}
36 {$mode delphi}
37 {$codepage UTF8}
38 {$interfaces COM}
39 {$ENDIF}
40
41 interface
42
43 uses
44 Classes, SysUtils, Firebird, IB, IBExternals;
45
46 type
47 {The IFBUDRExternalContext interface provides the Firebird IExternalContext
48 interface as a native pascal interface}
49
50 IFBUDRExternalContext = interface
51 ['{00b2616d-12e0-436a-8c2c-58670a2be805}']
52 function GetFirebirdAPI: IFirebirdAPI;
53 function GetAttachment: IAttachment;
54 function GetTransaction: ITransaction;
55 function GetUserName: AnsiString;
56 function GetDatabaseName: AnsiString;
57 function GetClientCharSet: AnsiString;
58 function obtainInfoCode: Integer;
59 function getInfo(code: Integer): Pointer;
60 function setInfo(code: Integer; value: Pointer): Pointer;
61 function getStatus: Firebird.IStatus;
62 procedure CheckStatus;
63 function HasConfigFile: boolean;
64 function ReadConfigString(Section, Ident, DefaultValue: AnsiString): AnsiString;
65 function ReadConfigInteger(Section, Ident: AnsiString; DefaultValue: integer): integer;
66 function ReadConfigBool(Section, Ident: AnsiString; DefaultValue: boolean): boolean;
67 procedure WriteToLog(Msg: AnsiString);
68 end;
69
70 TFBUDRTriggerType = (ttAfter, ttBefore, ttDatabase);
71 IFBUDRMessageMetadata = interface;
72
73 {The IFBUDRRoutineMetadata interface provides the Firebird IRoutineMetadata
74 interface as a native Pascal interface}
75
76 IFBUDRRoutineMetadata = interface
77 ['{28a03226-e8df-40e8-b67f-d3dc27886e9f}']
78 function getPackage: AnsiString;
79 function getName: AnsiString;
80 function getEntryPoint: AnsiString; {response is parsed into the following three components}
81 function getModuleName: AnsiString;
82 function getRoutineName: AnsiString;
83 function getInfo: AnsiString;
84 function getBody: AnsiString;
85 function HasInputMetadata: boolean;
86 function HasOutputMetadata: boolean;
87 function HasTriggerMetadata: boolean;
88 function getFBInputMetadata: IFBUDRMessageMetadata;
89 function getFBOutputMetadata: IFBUDRMessageMetadata;
90 function getFBTriggerMetadata: IFBUDRMessageMetadata;
91 function getTriggerTable: AnsiString;
92 function getTriggerType: TFBUDRTriggerType;
93 end;
94
95 {IFBUDRProcMetadata is a subset of IFBUDRRoutineMetadata and is used to provide
96 additional information for procedure and function calls}
97
98 IFBUDRProcMetadata = interface
99 ['{d20fc3ae-635e-4841-ad79-b4cd88be75d8}']
100 function getPackage: AnsiString;
101 function getName: AnsiString;
102 function getEntryPoint: AnsiString;
103 function getModuleName: AnsiString;
104 function getRoutineName: AnsiString;
105 function getInfo: AnsiString;
106 function getBody: AnsiString;
107 end;
108
109 {IFBUDRTriggerMetaData is a subset of IFBUDRRoutineMetadata and is used to provide
110 additional information for triggers}
111
112 IFBUDRTriggerMetaData = interface
113 ['{9458bad8-809a-469a-b13f-3a3ab95f8d94}']
114 function getName: AnsiString;
115 function getModuleName: AnsiString;
116 function getRoutineName: AnsiString;
117 function getInfo: AnsiString;
118 function getBody: AnsiString;
119 function getTriggerTable: AnsiString;
120 function getTriggerType: TFBUDRTriggerType;
121 end;
122
123
124 {IFBUDRInputParams is a subset of the IResults interface and is used to provide
125 the input parameters to an external function, procedure or trigger as a
126 Pascal interface using Pascal native types.}
127
128 IFBUDRInputParams = interface
129 ['{e49d096e-3a9c-4f75-bb39-db32b1897312}']
130 function getCount: integer;
131 function getSQLData(index: integer): ISQLData;
132 procedure GetData(index: integer; var IsNull:boolean; var len: short; var data: PByte);
133 function GetTransaction: ITransaction;
134 function GetAttachment: IAttachment;
135 function ParamExists(Idx: AnsiString): boolean;
136 function ByName(Idx: AnsiString): ISQLData;
137 property Data[index: integer]: ISQLData read getSQLData; default;
138 property Count: integer read getCount;
139 end;
140
141 {IFBUDROutputData is a subset of the ISQLParams interface and is used to return the
142 each output row for an external procedure}
143
144 IFBUDROutputData = interface
145 ['{8a7d7890-e9a4-430b-8cbc-3874b5f66b31}']
146 function getCount: integer;
147 function getSQLParam(index: integer): ISQLParam;
148 function GetModified: Boolean;
149 function GetHasCaseSensitiveParams: Boolean;
150 function GetTransaction: ITransaction;
151 function GetAttachment: IAttachment;
152 function ByName(Idx: AnsiString): ISQLParam ;
153 procedure Clear;
154 property Modified: Boolean read GetModified;
155 property Params[index: integer]: ISQLParam read getSQLParam; default;
156 property Count: integer read getCount;
157 end;
158
159 {IFBUDRMetadataBuilder provides the FIrebird IMetadataBuilder interface
160 as a native Pascal Interface}
161
162 IFBUDRMetadataBuilder = interface
163 ['{a6876fed-fd70-40f0-b965-6c43b8c5c00d}']
164 procedure setType(index: Cardinal; type_: Cardinal);
165 procedure setSubType(index: Cardinal; subType: Integer);
166 procedure setLength(index: Cardinal; length: Cardinal);
167 procedure setCharSet(index: Cardinal; charSet: Cardinal);
168 procedure setScale(index: Cardinal; scale: Integer);
169 procedure truncate(count: Cardinal);
170 procedure moveNameToIndex(name: AnsiString; index: Cardinal);
171 procedure remove(index: Cardinal);
172 function addField:Cardinal;
173 procedure setField(index: Cardinal; field: AnsiString);
174 procedure setRelation(index: Cardinal; relation: AnsiString);
175 procedure setOwner(index: Cardinal; owner: AnsiString);
176 procedure setAlias(index: Cardinal; alias: AnsiString);
177 end;
178
179 IFBUDRMessageMetadata = interface
180 ['{da84190f-91a3-40ae-9fab-bbfd98a49dcb}']
181 function getCount: Cardinal;
182 function getField(index: Cardinal): AnsiString;
183 function getRelation(index: Cardinal): AnsiString;
184 function getOwner(index: Cardinal): AnsiString;
185 function getAlias(index: Cardinal): AnsiString;
186 function getType(index: Cardinal): Cardinal;
187 function isNullable(index: Cardinal): Boolean;
188 function getSubType(index: Cardinal): Integer;
189 function getLength(index: Cardinal): Cardinal;
190 function getScale(index: Cardinal): Integer;
191 function getCharSet(index: Cardinal): Cardinal;
192 function getOffset(index: Cardinal): Cardinal;
193 function getNullOffset(index: Cardinal): Cardinal;
194 function getBuilder: IFBUDRMetadataBuilder;
195 function getMessageLength: Cardinal;
196 function getAlignment: Cardinal;
197 function getAlignedLength: Cardinal;
198 end;
199
200
201
202 implementation
203
204 end.
205