ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/public/ibx/branches/udr/client/FBMessages.pas
Revision: 291
Committed: Fri Apr 17 10:26:08 2020 UTC (4 years, 7 months ago) by tony
Content type: text/x-pascal
Original Path: ibx/trunk/fbintf/client/FBMessages.pas
File size: 12574 byte(s)
Log Message:
Changed for 2.3.4 merged into public release

File Contents

# Content
1 (*
2 * Firebird Interface (fbintf). The fbintf components provide a set of
3 * Pascal language bindings for the Firebird API. Although predominantly
4 * a new development they include source code taken from IBX and may be
5 * considered a derived product. This software thus also includes the copyright
6 * notice and license conditions from IBX.
7 *
8 * Except for those parts dervied from IBX, contents of this file are subject
9 * to the Initial Developer's Public License Version 1.0 (the "License"); you
10 * may not use this file except in compliance with the License. You may obtain a
11 * copy of the License here:
12 *
13 * http://www.firebirdsql.org/index.php?op=doc&id=idpl
14 *
15 * Software distributed under the License is distributed on an "AS
16 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
17 * implied. See the License for the specific language governing rights
18 * and limitations under the License.
19 *
20 * The Initial Developer of the Original Code is Tony Whyman.
21 *
22 * The Original Code is (C) 2016 Tony Whyman, MWA Software
23 * (http://www.mwasoftware.co.uk).
24 *
25 * All Rights Reserved.
26 *
27 * Contributor(s): ______________________________________.
28 *
29 *)
30 {************************************************************************}
31 { }
32 { Borland Delphi Visual Component Library }
33 { InterBase Express core components }
34 { }
35 { Copyright (c) 1998-2000 Inprise Corporation }
36 { }
37 { InterBase Express is based in part on the product }
38 { Free IB Components, written by Gregory H. Deatz for }
39 { Hoagland, Longo, Moran, Dunst & Doukas Company. }
40 { Free IB Components is used under license. }
41 { }
42 { The contents of this file are subject to the InterBase }
43 { Public License Version 1.0 (the "License"); you may not }
44 { use this file except in compliance with the License. You }
45 { may obtain a copy of the License at http://www.Inprise.com/IPL.html }
46 { Software distributed under the License is distributed on }
47 { an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either }
48 { express or implied. See the License for the specific language }
49 { governing rights and limitations under the License. }
50 { The Original Code was created by InterBase Software Corporation }
51 { and its successors. }
52 { Portions created by Inprise Corporation are Copyright (C) Inprise }
53 { Corporation. All Rights Reserved. }
54 { Contributor(s): Jeff Overcash }
55 { }
56 { IBX For Lazarus (Firebird Express) }
57 { Contributor: Tony Whyman, MWA Software http://www.mwasoftware.co.uk }
58 { Portions created by MWA Software are copyright McCallum Whyman }
59 { Associates Ltd 2011 - 2015 }
60 { }
61 {************************************************************************}
62 unit FBMessages;
63 {$IFDEF MSWINDOWS}
64 {$DEFINE WINDOWS}
65 {$ENDIF}
66
67 {$IFDEF FPC}
68 {$mode delphi}
69 {$codepage UTF8}
70 {$ENDIF}
71
72 interface
73
74 uses
75 Classes, SysUtils;
76
77 type
78 TIBClientError = (
79 ibxeInterBaseMissing,
80 ibxeIB60feature,
81 ibxeNotSupported,
82 ibxeNotPermitted,
83 ibxeDatabaseClosed,
84 ibxeNotInTransaction,
85 ibxeTransactionNotAssigned,
86 ibxeEOF,
87 ibxeBOF,
88 ibxeInvalidStatementHandle,
89 ibxeSQLClosed,
90 ibxeUnknownSQLDataType,
91 ibxeInvalidColumnIndex,
92 ibxeInvalidDataConversion,
93 ibxeBlobCannotBeRead,
94 ibxeBlobCannotBeWritten,
95 ibxeBlobNotOpen,
96 ibxeEmptyQuery,
97 ibxeFieldNotFound,
98 ibxeSQLParseError,
99 ibxeIsASelectStatement,
100 ibxeIsAExecuteProcedure,
101 ibxeMaximumEvents,
102 ibxeServiceActive,
103 ibxeServiceInActive,
104 ibxeServerNameMissing,
105 ibxeOutputParsingError,
106 ibxeEmptyAttachmentsList,
107 ibxeInfoBufferTypeError,
108 ibxServiceRequestIndexError,
109 ibxServiceParamTypeError,
110 ibxeOutputBlockIndexError,
111 ibxeOutputBlockTypeError,
112 ibxePBIndexError,
113 ibxePBParamTypeError,
114 ibxeDuplicateParamName,
115 ibxeInvalidArrayDimensions,
116 ibxeNotAMultiDatabaseTransaction,
117 ibxeAttachmentListIndexError,
118 ibxeNotAnArray,
119 ibxeNotABlob,
120 ibxeInvalidSubscript,
121 ibxeArrayElementOverFlow,
122 ibxArrayBoundsCantIncrease ,
123 ibxeStatementNotPrepared,
124 ibxeInterfaceOutofDate,
125 ibxeInvalidBlobMetaData,
126 ibxeNoDPB,
127 ibxeInEventWait,
128 ibxeIncompatibleBlob,
129 ibxeMissingColumnName,
130 ibxStringTooLong,
131 ibxFieldNotinDataSet,
132 ibxeNoDefaultCharacterSet,
133 ibxeParamBufferOverflow,
134 ibxeInvalidParamCount,
135 ibxeInvalidVariantType,
136 ibxeInterfaceNotSupported,
137 ibxeCharacterSetExists,
138 ibxeUnknownUserCharSet,
139 ibxeUninitializedInputParameter,
140 ibxeMultiThreadRequired,
141 ibxeTokenQueueOverflow,
142 ibxeTokenQueueUnderflow,
143 ibxErrorParsing,
144 ibxeDLInfoError,
145 ibxeDifferentAPIs
146 );
147
148 function GetErrorMessage(ErrMess: TIBClientError): AnsiString;
149
150 {IBError is used internally and by IBX to throw an EIBClientError}
151
152 procedure IBError(ErrMess: TIBClientError; const Args: array of const);
153
154 resourcestring
155 { generic strings used in code }
156 SParamNameExpected = 'Parameter name expected';
157 sSQLErrorSeparator = ' When Executing: ';
158 SFirebirdAPIFuncNotFound = 'Unable to load Firebird Client Library Function "%s"';
159 STrue = 'true';
160 SFalse = 'false';
161 SArray = '(array)';
162
163 implementation
164
165 uses IBUtils, IB;
166
167 resourcestring
168
169 { strings used in error messages}
170 SInterBaseMissing = 'Firebird library not found in the path. Please install Firebird to use this functionality';
171 SIB60feature = '%s is an InterBase 6 function. Please upgrade to InterBase 6 to use this functonality';
172 SNotSupported = 'Unsupported feature';
173 SNotPermitted = 'Not permitted';
174 SDatabaseClosed = 'Cannot perform operation -- DB is not open';
175 SNotInTransaction = 'Transaction is not active';
176 STransactionNotAssigned = 'Transaction not assigned';
177 SEOF = 'End of file';
178 SBOF = 'Beginning of file';
179 SInvalidStatementHandle = 'Invalid statement handle';
180 SSQLClosed = 'IBSQL Closed';
181 SUnknownSQLDataType = 'Unknown SQL Data type (%d)';
182 SInvalidColumnIndex = 'Invalid column index (index exceeds permitted range)';
183 SInvalidDataConversion = 'Invalid data conversion';
184 SBlobCannotBeRead = 'Blob stream cannot be read';
185 SBlobCannotBeWritten = 'Blob stream cannot be written';
186 SBlobNotOpen = 'The Blob is not open';
187 SEmptyQuery = 'Empty query';
188 SFieldNotFound = 'Field "%s" not found';
189 SSQLParseError = 'SQL Parse Error:' + CRLF + CRLF + '%s';
190 SIsASelectStatement = 'use Open for a Select Statement';
191 SIsAExecuteProcedure = 'use ExecProc for Procedure; use TQuery for Select procedures';
192 SMaximumEvents = 'Exceded Maximum Event limits';
193 SServiceActive = 'Cannot perform operation -- service is not attached';
194 SServiceInActive = 'Cannot perform operation -- service is attached';
195 SServerNameMissing = 'Server Name Missing';
196 SOutputParsingError = 'Unexpected Output buffer value (%d) - %s';
197 SEmptyAttachmentsList = 'The list of database attachments cannot be empty';
198 SInfoBufferTypeError = 'Invalid operation for Info Buffer Type (%d)';
199 SServiceRequestIndexError = 'Service Request Index Out of Range (%d)';
200 SServiceParamTypeError = 'Invalid Request for Service Param Type';
201 SOutputBlockIndexError = 'Output Block Index Out of Range (%d)';
202 SOutputBlockTypeError = 'Invalid Request for Output Block Type';
203 SPBIndexError = 'DPB Index out of range (%d)';
204 SPBParamTypeError = 'Invalid Request for DPB Param Type';
205 SDuplicateParamName = 'Blob or array parameter name must be unique (%s)';
206 SInvalidArrayDimensions = 'Invalid number of array dimensions (%d)';
207 SNotAMultiDatabaseTransaction = 'This is not a multi-database transaction';
208 SAttachmentListIndexError = 'Attachment List index out of range (%d)';
209 SNotAnArray = 'Table Column must be an array';
210 SNotABlob = 'Table Column must be a Blob';
211 SInvalidSubscript = 'Invalid Subscript (%d) for Array Dimension %d';
212 SArrayElementOverFlow = 'Array Element too big';
213 SArrayBoundsCantIncrease = 'Array Bounds can only be narrowed';
214 SStatementNotPrepared = 'The Statement has not been prepared';
215 SInterfaceOutofDate = 'This interface is no longer up-to-date';
216 SInvalidBlobMetaData = 'Unable to Access Blob Meta Data';
217 SNoDPB = 'A DPB must be provided';
218 SInEventWait = 'Already in Event Wait State';
219 SIncompatibleBlob = 'Incompatible Blob SubTypes. %d expected, %d found';
220 SMissingColumnName = 'Relation or Column Name Missing';
221 SStringTooLong = 'String "%s" is too long. Max %d characters';
222 SFieldNotinDataSet = 'Field %s is not a member of DataSet %s';
223 SNoDefaultCharacterSet = 'A connection default character set is required to perform this operation';
224 SParamBufferOverflow = 'Parameter Buffer Overflow';
225 SInvalidParamCount = 'Invalid Parameter Count. %d expected, %d found';
226 SInvalidVariantType = 'Invalid variant type';
227 SInterfaceNotSupported = 'Interface not supported; Guid %s not found';
228 SCharacterSetExists = 'Character set "%s" is already defined';
229 SUnknownUserCharSet = 'Unknown user character set "%s"';
230 SUninitializedInputParameter = 'SQL Param No. %d (%s) is uninitialised';
231 SMultiThreadRequired = 'Multi-threading required for %s but not enabled. Please recompile with multi-threading support enabled. '+
232 'Hint: you probably need to add -dUseCThreads to the Custom Options.';
233 STokenQueueOverflow = 'Error in SQL Token Analyser - token queue overflow';
234 STokenQueueUnderflow = 'Error in SQL Token Analyser - token queue underflow';
235 SErrorParsing = 'Error parsing SQL Statement at clause starting with %s';
236 SDLInfoError = 'dlinfo returned error - %s';
237 SDifferentAPIs = 'All transaction attachments must use the same Firebird Library';
238
239 const
240 IBErrorMessages: array[TIBClientError] of string = (
241 SInterBaseMissing,
242 SIB60feature,
243 SNotSupported,
244 SNotPermitted,
245 SDatabaseClosed,
246 SNotInTransaction,
247 STransactionNotAssigned,
248 SEOF,
249 SBOF,
250 SInvalidStatementHandle,
251 SSQLClosed,
252 SUnknownSQLDataType,
253 SInvalidColumnIndex,
254 SInvalidDataConversion,
255 SBlobCannotBeRead,
256 SBlobCannotBeWritten,
257 SBlobNotOpen,
258 SEmptyQuery,
259 SFieldNotFound,
260 SSQLParseError,
261 SIsASelectStatement,
262 SIsAExecuteProcedure,
263 SMaximumEvents,
264 SServiceActive,
265 SServiceInActive,
266 SServerNameMissing,
267 SOutputParsingError,
268 SEmptyAttachmentsList,
269 SInfoBufferTypeError,
270 SServiceRequestIndexError,
271 SServiceParamTypeError,
272 SOutputBlockIndexError,
273 SOutputBlockTypeError,
274 SPBIndexError,
275 SPBParamTypeError,
276 SDuplicateParamName,
277 SInvalidArrayDimensions,
278 SNotAMultiDatabaseTransaction,
279 SAttachmentListIndexError,
280 SNotAnArray,
281 SNotABlob,
282 SInvalidSubscript,
283 SArrayElementOverFlow,
284 SArrayBoundsCantIncrease,
285 SStatementNotPrepared,
286 SInterfaceOutofDate,
287 SInvalidBlobMetaData,
288 SNoDPB,
289 SInEventWait,
290 SIncompatibleBlob,
291 SMissingColumnName,
292 SStringTooLong,
293 SFieldNotinDataSet,
294 SNoDefaultCharacterSet,
295 SParamBufferOverflow,
296 SInvalidParamCount,
297 SInvalidVariantType,
298 SInterfaceNotSupported,
299 SCharacterSetExists,
300 SUnknownUserCharSet,
301 SUninitializedInputParameter,
302 SMultiThreadRequired,
303 STokenQueueOverflow,
304 STokenQueueUnderflow,
305 SErrorParsing,
306 SDLInfoError,
307 SDifferentAPIs
308 );
309
310 function GetErrorMessage(ErrMess: TIBClientError): AnsiString;
311 begin
312 Result := IBErrorMessages[ErrMess];
313 end;
314
315 procedure IBError(ErrMess: TIBClientError; const Args: array of const);
316 begin
317 raise EIBClientError.Create(Ord(ErrMess),
318 Format(GetErrorMessage(ErrMess), Args));
319 end;
320
321 end.
322