ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/public/ibx/trunk/runtime/IBMessages.pas
Revision: 311
Committed: Mon Aug 24 09:32:58 2020 UTC (4 years, 3 months ago) by tony
Content type: text/x-pascal
File size: 16040 byte(s)
Log Message:
Fixes merged

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 IBMessages;
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 ibxeUnknownError,
80 ibxeIB60feature,
81 ibxeNotSupported,
82 ibxeOperationCancelled,
83 ibxeDPBConstantNotSupported,
84 ibxeDPBConstantUnknown,
85 ibxeTPBConstantNotSupported,
86 ibxeTPBConstantUnknown,
87 ibxeDatabaseClosed,
88 ibxeDatabaseOpen,
89 ibxeDatabaseNameMissing,
90 ibxeNotInTransaction,
91 ibxeInTransaction,
92 ibxeTimeoutNegative,
93 ibxeNoDatabasesInTransaction,
94 ibxeUpdateWrongDB,
95 ibxeUpdateWrongTR,
96 ibxeDatabaseNotAssigned,
97 ibxeTransactionNotAssigned,
98 ibxeInvalidStatementHandle,
99 ibxeSQLOpen,
100 ibxeSQLClosed,
101 ibxeDatasetOpen,
102 ibxeDatasetClosed,
103 ibxeInvalidColumnIndex,
104 ibxeBlobCannotBeRead,
105 ibxeBlobCannotBeWritten,
106 ibxeEmptyQuery,
107 ibxeNoFieldAccess,
108 ibxeFieldNotFound,
109 ibxeNotEditing,
110 ibxeCannotInsert,
111 ibxeCannotUpdate,
112 ibxeCannotDelete,
113 ibxeCannotRefresh,
114 ibxeBufferNotSet,
115 ibxeCircularReference,
116 ibxeUserAbort,
117 ibxeDataSetUniDirectional,
118 ibxeCannotCreateSharedResource,
119 ibxeFieldUnsupportedType,
120 ibxeCircularDataLink,
121 ibxeEmptySQLStatement,
122 ibxeIsASelectStatement,
123 ibxeRequiredParamNotSet,
124 ibxeNoStoredProcName,
125 ibxeIsAExecuteProcedure,
126 ibxeUpdateFailed,
127 ibxeNoRecordsAffected,
128 ibxeNoTableName,
129 ibxeTableNameMismatch,
130 ibxeIndexFieldMissing,
131 ibxeInvalidEvent,
132 ibxeMaximumEvents,
133 ibxeInvalidBatchMove,
134 ibxeSQLDialectInvalid,
135 ibxeSPBConstantNotSupported,
136 ibxeSPBConstantUnknown,
137 ibxeServiceActive,
138 ibxeServiceInActive,
139 ibxeServerNameMissing,
140 ibxeQueryParamsError,
141 ibxeStartParamsError,
142 ibxeOutputParsingError,
143 ibxeUseSpecificProcedures,
144 ibxeDPBConstantUnknownEx,
145 ibxeTPBConstantUnknownEx,
146 ibxeSV5APIError,
147 ibxeThreadFailed,
148 ibxeFieldSizeError,
149 ibxeNoLoginDialog,
150 ibxeInfoBufferIndexError,
151 ibxServiceRequestIndexError,
152 ibxServiceParamTypeError,
153 ibxArrayBoundsCantIncrease ,
154 ibxeUnexpectedDatabaseInfoResp,
155 ibxStringTooLong,
156 ibxFieldNotinDataSet,
157 ibxeNotCurrentArray,
158 ibxeServiceRunning,
159 ibxeUniqueRelationReqd,
160 ibxeNegativeGenerator,
161 ibxeServiceUnavailable,
162 ibxeBadConnectString,
163 ibxeServiceNotStarted,
164 ibxeNotRequiredDataSetSource,
165 ibxeNoLimboTransactionInsert,
166 ibxeDatabaseNotConnected,
167 ibxeMultiThreadRequired,
168 ibxeODSVersionRequired,
169 ibxErrorParsing,
170 ibxeParameterNameNotFound,
171 ibxeListFieldNotFound,
172 ibxeDBBufferTooSmall
173 );
174
175 function GetErrorMessage(ErrMess: TIBClientError): AnsiString;
176
177 {IBError is used internally and by IBX to throw an EIBClientError}
178
179 procedure IBError(ErrMess: TIBClientError; const Args: array of const);
180 resourcestring
181 { generic strings used in code }
182 SEOFReached = 'SEOFReached';
183 SCantPrintValue = 'Cannot print value';
184 SDisconnectDatabase = 'Database is currently connected. Disconnect and continue?';
185 SCommitTransaction = 'Transaction is currently Active. Rollback and continue?';
186 sSQLErrorSeparator = ' When Executing: ';
187 SDatabaseFilter = 'Database Files (*.fdb; *.gdb)|*.gdb; *.fdb|All files (*.*)|*.*';
188 {$IFDEF WINDOWS}
189 SLibraryNameFilter = 'DLLs (*.dll)|*.dll|All files (*.*)|*.*';
190 {$ELSE}
191 SLibraryNameFilter = 'All files (*.*)|*.*';
192 {$ENDIF}
193 STrue = 'true';
194 SFalse = 'false';
195 SArray = '(array)';
196 SBlob = '(blob)';
197
198 implementation
199
200 uses IBUtils, IB;
201
202 resourcestring
203
204 { strings used in error messages}
205 SUnknownError = 'Unknown error';
206 SIB60feature = '%s is an InterBase 6 function. Please upgrade to InterBase 6 to use this functonality';
207 SNotSupported = 'Unsupported feature';
208 SOperationCancelled = 'Operation cancelled at user''s request';
209 SDPBConstantNotSupported = 'DPB Constant (isc_dpb_%s) is unsupported';
210 SDPBConstantUnknown = 'DPB Constant (%d) is unknown';
211 STPBConstantNotSupported = 'TPB Constant (isc_tpb_%s) is unsupported';
212 STPBConstantUnknown = 'TPB Constant (%d) is unknown';
213 SDatabaseClosed = 'Cannot perform operation -- DB is not open';
214 SDatabaseOpen = 'Cannot perform operation -- DB is currently open';
215 SDatabaseNameMissing = 'Database name is missing';
216 SNotInTransaction = 'Transaction is not active';
217 SInTransaction = 'Transaction is active';
218 STimeoutNegative = 'Timeout values cannot be negative';
219 SNoDatabasesInTransaction = 'No databases are listed in transaction component';
220 SUpdateWrongDB = 'Updating wrong database';
221 SUpdateWrongTR = 'Updating wrong transaction. Unique transaction expected in set';
222 SDatabaseNotAssigned = 'Database not assigned';
223 STransactionNotAssigned = 'Transaction not assigned';
224 SInvalidStatementHandle = 'Invalid statement handle';
225 SSQLOpen = 'IBSQL Open';
226 SSQLClosed = 'IBSQL Closed';
227 SDatasetOpen = 'Dataset open';
228 SDatasetClosed = 'Dataset closed';
229 SInvalidColumnIndex = 'Invalid column index (index exceeds permitted range)';
230 SBlobCannotBeRead = 'Blob stream cannot be read';
231 SBlobCannotBeWritten = 'Blob stream cannot be written';
232 SEmptyQuery = 'Empty query';
233 SNoFieldAccess = 'No access to field "%s"';
234 SFieldNotFound = 'Field "%s" not found';
235 SNotEditing = 'Not in edit mode';
236 SCannotInsert = 'Cannot insert into dataset. (No insert query)';
237 SCannotUpdate = 'Cannot update. (No update query)';
238 SCannotDelete = 'Cannot delete from dataset. (No delete query)';
239 SCannotRefresh = 'Cannot refresh row. (No refresh query)';
240 SBufferNotSet = 'Buffer not set';
241 SCircularReference = 'Circular references not permitted';
242 SUserAbort = 'User abort';
243 SDataSetUniDirectional = 'Data set is uni-directional';
244 {$IFDEF UNIX}
245 SCannotCreateSharedResource = 'Cannot create shared resource. %s';
246 {$ELSE}
247 SCannotCreateSharedResource = 'Cannot create shared resource. (Windows error %d)';
248 {$ENDIF}
249 SFieldUnsupportedType = 'Unsupported Field Type';
250 SCircularDataLink = 'Circular DataLink Reference';
251 SEmptySQLStatement = 'Empty SQL Statement';
252 SIsASelectStatement = 'use Open for a Select Statement';
253 SRequiredParamNotSet = 'Required parameter "%s" value not set';
254 SNoStoredProcName = 'No Stored Procedure Name assigned';
255 SIsAExecuteProcedure = 'use ExecProc for Procedure; use TQuery for Select procedures';
256 SUpdateFailed = 'Update Failed';
257
258 SNoRecordsAffected = 'No Records Affected';
259 SNoTableName = 'No Table Name assigned';
260 STableNameMismatch = 'Table Name Mismatch';
261 SIndexFieldMissing = 'Index Field Missing';
262 SInvalidEvent = 'Invalid Event';
263 SMaximumEvents = 'Exceded Maximum Event limits';
264 SInvalidBatchMove = 'Invalid Batch Move';
265 SSQLDialectInvalid = 'SQL Dialect Invalid';
266 SSPBConstantNotSupported = 'SPB Constant Not supported';
267 SSPBConstantUnknown = 'SPB Constant Unknown';
268 SServiceActive = 'Cannot perform operation -- service is not attached';
269 SServiceInActive = 'Cannot perform operation -- service is attached';
270 SServerNameMissing = 'Server Name Missing';
271 SQueryParamsError = 'Query Parameters missing or incorrect';
272 SStartParamsError = 'start Parameters missing or incorrect';
273 SOutputParsingError = 'Unexpected Output buffer value (%d) - %s';
274 SUseSpecificProcedures = 'Generic ServiceStart not applicable: Use Specific Procedures to set configuration params';
275
276 SDPBConstantUnknownEx = 'DPB Constant (%s) is unknown';
277 STPBConstantUnknownEx = 'TPB Constant (%s) is unknown';
278 SSV5APIError = 'SV5 API API Error - %s';
279 SThreadFailed = '%s Thread failed with Exception: %s';
280 SFieldSizeError = 'Field %s is too small (%d bytes) to receive the data (%d bytes)';
281 SNoLoginDialog = 'Default Login Dlalog not found. Have you included ibexpress ' +
282 'in your program uses list?';
283 SInfoBufferIndexError = 'Info Buffer Index Out of Range (%d)';
284 SServiceRequestIndexError = 'Service Request Index Out of Range (%d)';
285 SServiceParamTypeError = 'Invalid Request for Service Param Type';
286 SArrayBoundsCantIncrease = 'Array Bounds can only be narrowed';
287 SUnexpectedDatabaseInfoResp = 'Unexpected Database Information Response';
288 SStringTooLong = 'String "%s" is too long. Max %d characters';
289 SFieldNotinDataSet = 'Field %s is not a member of DataSet %s';
290 SNotCurrentArray = 'Cannot Edit an Array that is not part of the current record';
291 SServiceRunning = 'Cannot start a new service while an existing service is running';
292 SUniqueRelationReqd = 'All Output Fields must derived from the same table';
293 SNegativeGenerator = 'A Generator Increment cannot be negative';
294 SServiceUnavailable = 'Request Service is not available';
295 SBadConnectString = 'Parse Error in Connect String';
296 SServiceNotStarted = 'Cannot Query running service until the service has been started';
297 SNotRequiredDataSetSource = 'Object of class %s is not a valid dataset source';
298 SNoLimboTransactionInsert = 'You cannot add to a Limbo Transaction list';
299 SDatabaseNotConnected = 'Cannot connect using an unattached database';
300 SMultiThreadRequired = 'Multi-threading required for %s but not enabled. Please recompile with multi-threading support enabled. '+
301 'Hint: you probably need to add -dUseCThreads to the Custom Options.';
302 SODSVersionRequired = 'This feature requires ODS Version %s or later';
303 SErrorParsing = 'Error parsing SQL Statement at clause starting with %s';
304 SParameterNameNotFound = 'Parameter Name (%s) not found';
305 SListFieldNotFound = 'ListField Name is not a valid dataset column name (%s)';
306 SDBBufferTooSmall = 'Dataset buffer is too small (%d bytes) to receive the data from Field %s (%d bytes)';
307
308 const
309 IBErrorMessages: array[TIBClientError] of string = (
310 SUnknownError,
311 SIB60feature,
312 SNotSupported,
313 SOperationCancelled,
314 SDPBConstantNotSupported,
315 SDPBConstantUnknown,
316 STPBConstantNotSupported,
317 STPBConstantUnknown,
318 SDatabaseClosed,
319 SDatabaseOpen,
320 SDatabaseNameMissing,
321 SNotInTransaction,
322 SInTransaction,
323 STimeoutNegative,
324 SNoDatabasesInTransaction,
325 SUpdateWrongDB,
326 SUpdateWrongTR,
327 SDatabaseNotAssigned,
328 STransactionNotAssigned,
329 SInvalidStatementHandle,
330 SSQLOpen,
331 SSQLClosed,
332 SDatasetOpen,
333 SDatasetClosed,
334 SInvalidColumnIndex,
335 SBlobCannotBeRead,
336 SBlobCannotBeWritten,
337 SEmptyQuery,
338 SNoFieldAccess,
339 SFieldNotFound,
340 SNotEditing,
341 SCannotInsert,
342 SCannotUpdate,
343 SCannotDelete,
344 SCannotRefresh,
345 SBufferNotSet,
346 SCircularReference,
347 SUserAbort,
348 SDataSetUniDirectional,
349 SCannotCreateSharedResource,
350 SFieldUnsupportedType,
351 SCircularDataLink,
352 SEmptySQLStatement,
353 SIsASelectStatement,
354 SRequiredParamNotSet,
355 SNoStoredProcName,
356 SIsAExecuteProcedure,
357 SUpdateFailed,
358 SNoRecordsAffected,
359 SNoTableName,
360 STableNameMismatch,
361 SIndexFieldMissing,
362 SInvalidEvent,
363 SMaximumEvents,
364 SInvalidBatchMove,
365 SSQLDialectInvalid,
366 SSPBConstantNotSupported,
367 SSPBConstantUnknown,
368 SServiceActive,
369 SServiceInActive,
370 SServerNameMissing,
371 SQueryParamsError,
372 SStartParamsError,
373 SOutputParsingError,
374 SUseSpecificProcedures,
375 SDPBConstantUnknownEx,
376 STPBConstantUnknownEx,
377 SSV5APIError,
378 SThreadFailed,
379 SFieldSizeError,
380 SNoLoginDialog,
381 SInfoBufferIndexError,
382 SServiceRequestIndexError,
383 SServiceParamTypeError,
384 SArrayBoundsCantIncrease,
385 SUnexpectedDatabaseInfoResp,
386 SStringTooLong,
387 SFieldNotinDataSet,
388 SNotCurrentArray,
389 SServiceRunning,
390 SUniqueRelationReqd,
391 SNegativeGenerator,
392 SServiceUnavailable,
393 SBadConnectString,
394 SServiceNotStarted,
395 SNotRequiredDataSetSource,
396 SNoLimboTransactionInsert,
397 SDatabaseNotConnected,
398 SMultiThreadRequired,
399 SODSVersionRequired,
400 SErrorParsing,
401 SParameterNameNotFound,
402 SListFieldNotFound,
403 SDBBufferTooSmall
404 );
405
406 function GetErrorMessage(ErrMess: TIBClientError): AnsiString;
407 begin
408 Result := IBErrorMessages[ErrMess];
409 end;
410
411 procedure IBError(ErrMess: TIBClientError; const Args: array of const);
412 begin
413 raise EIBClientError.Create(Ord(ErrMess),
414 Format(GetErrorMessage(ErrMess), Args));
415 end;
416
417 end.
418