ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/public/ibx/branches/udr/udr/source/FBUDRIntf.pas
Revision: 381
Committed: Sat Jan 15 00:06:22 2022 UTC (2 years, 2 months ago) by tony
Content type: text/x-pascal
File size: 7280 byte(s)
Log Message:
Release Candidate 1

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 end;
107
108 {IFBUDRTriggerMetaData is a subset of IFBUDRRoutineMetadata and is used to provide
109 additional information for triggers}
110
111 IFBUDRTriggerMetaData = interface
112 ['{9458bad8-809a-469a-b13f-3a3ab95f8d94}']
113 function getName: AnsiString;
114 function getModuleName: AnsiString;
115 function getRoutineName: AnsiString;
116 function getInfo: AnsiString;
117 function getTriggerTable: AnsiString;
118 function getTriggerType: TFBUDRTriggerType;
119 end;
120
121
122 {IFBUDRInputParams is a subset of the IResults interface and is used to provide
123 the input parameters to an external function, procedure or trigger as a
124 Pascal interface using Pascal native types.}
125
126 IFBUDRInputParams = interface
127 ['{e49d096e-3a9c-4f75-bb39-db32b1897312}']
128 function getCount: integer;
129 function getSQLData(index: integer): ISQLData;
130 function ParamExists(Idx: AnsiString): boolean;
131 function ByName(Idx: AnsiString): ISQLData;
132 property Data[index: integer]: ISQLData read getSQLData; default;
133 property Count: integer read getCount;
134 end;
135
136 {IFBUDROutputData is a subset of the ISQLParams interface and is used to return the
137 each output row for an external procedure}
138
139 IFBUDROutputData = interface
140 ['{8a7d7890-e9a4-430b-8cbc-3874b5f66b31}']
141 function getCount: integer;
142 function getSQLParam(index: integer): ISQLParam;
143 function GetModified: Boolean;
144 function GetHasCaseSensitiveParams: Boolean;
145 function ByName(Idx: AnsiString): ISQLParam ;
146 procedure Clear;
147 property Modified: Boolean read GetModified;
148 property Params[index: integer]: ISQLParam read getSQLParam; default;
149 property Count: integer read getCount;
150 end;
151
152 {IFBUDRMetadataBuilder provides the FIrebird IMetadataBuilder interface
153 as a native Pascal Interface}
154
155 IFBUDRMetadataBuilder = interface
156 ['{a6876fed-fd70-40f0-b965-6c43b8c5c00d}']
157 procedure setType(index: Cardinal; type_: Cardinal);
158 procedure setSubType(index: Cardinal; subType: Integer);
159 procedure setLength(index: Cardinal; length: Cardinal);
160 procedure setCharSet(index: Cardinal; charSet: Cardinal);
161 procedure setScale(index: Cardinal; scale: Integer);
162 procedure truncate(count: Cardinal);
163 procedure moveNameToIndex(name: AnsiString; index: Cardinal);
164 procedure remove(index: Cardinal);
165 function addField:Cardinal;
166 procedure setField(index: Cardinal; field: AnsiString);
167 procedure setRelation(index: Cardinal; relation: AnsiString);
168 procedure setOwner(index: Cardinal; owner: AnsiString);
169 procedure setAlias(index: Cardinal; alias: AnsiString);
170 end;
171
172 IFBUDRMessageMetadata = interface
173 ['{da84190f-91a3-40ae-9fab-bbfd98a49dcb}']
174 function getCount: Cardinal;
175 function getField(index: Cardinal): AnsiString;
176 function getRelation(index: Cardinal): AnsiString;
177 function getOwner(index: Cardinal): AnsiString;
178 function getAlias(index: Cardinal): AnsiString;
179 function getType(index: Cardinal): Cardinal;
180 function isNullable(index: Cardinal): Boolean;
181 function getSubType(index: Cardinal): Integer;
182 function getLength(index: Cardinal): Cardinal;
183 function getScale(index: Cardinal): Integer;
184 function getCharSet(index: Cardinal): Cardinal;
185 function getOffset(index: Cardinal): Cardinal;
186 function getNullOffset(index: Cardinal): Cardinal;
187 function getBuilder: IFBUDRMetadataBuilder;
188 function getMessageLength: Cardinal;
189 function getAlignment: Cardinal;
190 function getAlignedLength: Cardinal;
191 end;
192
193
194
195 implementation
196
197 end.
198

Properties

Name Value
svn:eol-style native