ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/public/ibx/trunk/runtime/IBMessages.pas
Revision: 299
Committed: Fri Apr 17 21:50:43 2020 UTC (4 years, 7 months ago) by tony
Content type: text/x-pascal
File size: 15858 byte(s)
Log Message:
Added Back IBMessages.pas

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 );
173
174 function GetErrorMessage(ErrMess: TIBClientError): AnsiString;
175
176 {IBError is used internally and by IBX to throw an EIBClientError}
177
178 procedure IBError(ErrMess: TIBClientError; const Args: array of const);
179 resourcestring
180 { generic strings used in code }
181 SEOFReached = 'SEOFReached';
182 SCantPrintValue = 'Cannot print value';
183 SDisconnectDatabase = 'Database is currently connected. Disconnect and continue?';
184 SCommitTransaction = 'Transaction is currently Active. Rollback and continue?';
185 sSQLErrorSeparator = ' When Executing: ';
186 SDatabaseFilter = 'Database Files (*.fdb; *.gdb)|*.gdb; *.fdb|All files (*.*)|*.*';
187 {$IFDEF WINDOWS}
188 SLibraryNameFilter = 'DLLs (*.dll)|*.dll|All files (*.*)|*.*';
189 {$ELSE}
190 SLibraryNameFilter = 'All files (*.*)|*.*';
191 {$ENDIF}
192 STrue = 'true';
193 SFalse = 'false';
194 SArray = '(array)';
195 SBlob = '(blob)';
196
197 implementation
198
199 uses IBUtils, IB;
200
201 resourcestring
202
203 { strings used in error messages}
204 SUnknownError = 'Unknown error';
205 SIB60feature = '%s is an InterBase 6 function. Please upgrade to InterBase 6 to use this functonality';
206 SNotSupported = 'Unsupported feature';
207 SOperationCancelled = 'Operation cancelled at user''s request';
208 SDPBConstantNotSupported = 'DPB Constant (isc_dpb_%s) is unsupported';
209 SDPBConstantUnknown = 'DPB Constant (%d) is unknown';
210 STPBConstantNotSupported = 'TPB Constant (isc_tpb_%s) is unsupported';
211 STPBConstantUnknown = 'TPB Constant (%d) is unknown';
212 SDatabaseClosed = 'Cannot perform operation -- DB is not open';
213 SDatabaseOpen = 'Cannot perform operation -- DB is currently open';
214 SDatabaseNameMissing = 'Database name is missing';
215 SNotInTransaction = 'Transaction is not active';
216 SInTransaction = 'Transaction is active';
217 STimeoutNegative = 'Timeout values cannot be negative';
218 SNoDatabasesInTransaction = 'No databases are listed in transaction component';
219 SUpdateWrongDB = 'Updating wrong database';
220 SUpdateWrongTR = 'Updating wrong transaction. Unique transaction expected in set';
221 SDatabaseNotAssigned = 'Database not assigned';
222 STransactionNotAssigned = 'Transaction not assigned';
223 SInvalidStatementHandle = 'Invalid statement handle';
224 SSQLOpen = 'IBSQL Open';
225 SSQLClosed = 'IBSQL Closed';
226 SDatasetOpen = 'Dataset open';
227 SDatasetClosed = 'Dataset closed';
228 SInvalidColumnIndex = 'Invalid column index (index exceeds permitted range)';
229 SBlobCannotBeRead = 'Blob stream cannot be read';
230 SBlobCannotBeWritten = 'Blob stream cannot be written';
231 SEmptyQuery = 'Empty query';
232 SNoFieldAccess = 'No access to field "%s"';
233 SFieldNotFound = 'Field "%s" not found';
234 SNotEditing = 'Not in edit mode';
235 SCannotInsert = 'Cannot insert into dataset. (No insert query)';
236 SCannotUpdate = 'Cannot update. (No update query)';
237 SCannotDelete = 'Cannot delete from dataset. (No delete query)';
238 SCannotRefresh = 'Cannot refresh row. (No refresh query)';
239 SBufferNotSet = 'Buffer not set';
240 SCircularReference = 'Circular references not permitted';
241 SUserAbort = 'User abort';
242 SDataSetUniDirectional = 'Data set is uni-directional';
243 {$IFDEF UNIX}
244 SCannotCreateSharedResource = 'Cannot create shared resource. %s';
245 {$ELSE}
246 SCannotCreateSharedResource = 'Cannot create shared resource. (Windows error %d)';
247 {$ENDIF}
248 SFieldUnsupportedType = 'Unsupported Field Type';
249 SCircularDataLink = 'Circular DataLink Reference';
250 SEmptySQLStatement = 'Empty SQL Statement';
251 SIsASelectStatement = 'use Open for a Select Statement';
252 SRequiredParamNotSet = 'Required parameter "%s" value not set';
253 SNoStoredProcName = 'No Stored Procedure Name assigned';
254 SIsAExecuteProcedure = 'use ExecProc for Procedure; use TQuery for Select procedures';
255 SUpdateFailed = 'Update Failed';
256
257 SNoRecordsAffected = 'No Records Affected';
258 SNoTableName = 'No Table Name assigned';
259 STableNameMismatch = 'Table Name Mismatch';
260 SIndexFieldMissing = 'Index Field Missing';
261 SInvalidEvent = 'Invalid Event';
262 SMaximumEvents = 'Exceded Maximum Event limits';
263 SInvalidBatchMove = 'Invalid Batch Move';
264 SSQLDialectInvalid = 'SQL Dialect Invalid';
265 SSPBConstantNotSupported = 'SPB Constant Not supported';
266 SSPBConstantUnknown = 'SPB Constant Unknown';
267 SServiceActive = 'Cannot perform operation -- service is not attached';
268 SServiceInActive = 'Cannot perform operation -- service is attached';
269 SServerNameMissing = 'Server Name Missing';
270 SQueryParamsError = 'Query Parameters missing or incorrect';
271 SStartParamsError = 'start Parameters missing or incorrect';
272 SOutputParsingError = 'Unexpected Output buffer value (%d) - %s';
273 SUseSpecificProcedures = 'Generic ServiceStart not applicable: Use Specific Procedures to set configuration params';
274
275 SDPBConstantUnknownEx = 'DPB Constant (%s) is unknown';
276 STPBConstantUnknownEx = 'TPB Constant (%s) is unknown';
277 SSV5APIError = 'SV5 API API Error - %s';
278 SThreadFailed = '%s Thread failed with Exception: %s';
279 SFieldSizeError = 'Field %s is too small to receive the data';
280 SNoLoginDialog = 'Default Login Dlalog not found. Have you included ibexpress ' +
281 'in your program uses list?';
282 SInfoBufferIndexError = 'Info Buffer Index Out of Range (%d)';
283 SServiceRequestIndexError = 'Service Request Index Out of Range (%d)';
284 SServiceParamTypeError = 'Invalid Request for Service Param Type';
285 SArrayBoundsCantIncrease = 'Array Bounds can only be narrowed';
286 SUnexpectedDatabaseInfoResp = 'Unexpected Database Information Response';
287 SStringTooLong = 'String "%s" is too long. Max %d characters';
288 SFieldNotinDataSet = 'Field %s is not a member of DataSet %s';
289 SNotCurrentArray = 'Cannot Edit an Array that is not part of the current record';
290 SServiceRunning = 'Cannot start a new service while an existing service is running';
291 SUniqueRelationReqd = 'All Output Fields must derived from the same table';
292 SNegativeGenerator = 'A Generator Increment cannot be negative';
293 SServiceUnavailable = 'Request Service is not available';
294 SBadConnectString = 'Parse Error in Connect String';
295 SServiceNotStarted = 'Cannot Query running service until the service has been started';
296 SNotRequiredDataSetSource = 'Object of class %s is not a valid dataset source';
297 SNoLimboTransactionInsert = 'You cannot add to a Limbo Transaction list';
298 SDatabaseNotConnected = 'Cannot connect using an unattached database';
299 SMultiThreadRequired = 'Multi-threading required for %s but not enabled. Please recompile with multi-threading support enabled. '+
300 'Hint: you probably need to add -dUseCThreads to the Custom Options.';
301 SODSVersionRequired = 'This feature requires ODS Version %s or later';
302 SErrorParsing = 'Error parsing SQL Statement at clause starting with %s';
303 SParameterNameNotFound = 'Parameter Name (%s) not found';
304 SListFieldNotFound = 'ListField Name is not a valid dataset column name (%s)';
305
306 const
307 IBErrorMessages: array[TIBClientError] of string = (
308 SUnknownError,
309 SIB60feature,
310 SNotSupported,
311 SOperationCancelled,
312 SDPBConstantNotSupported,
313 SDPBConstantUnknown,
314 STPBConstantNotSupported,
315 STPBConstantUnknown,
316 SDatabaseClosed,
317 SDatabaseOpen,
318 SDatabaseNameMissing,
319 SNotInTransaction,
320 SInTransaction,
321 STimeoutNegative,
322 SNoDatabasesInTransaction,
323 SUpdateWrongDB,
324 SUpdateWrongTR,
325 SDatabaseNotAssigned,
326 STransactionNotAssigned,
327 SInvalidStatementHandle,
328 SSQLOpen,
329 SSQLClosed,
330 SDatasetOpen,
331 SDatasetClosed,
332 SInvalidColumnIndex,
333 SBlobCannotBeRead,
334 SBlobCannotBeWritten,
335 SEmptyQuery,
336 SNoFieldAccess,
337 SFieldNotFound,
338 SNotEditing,
339 SCannotInsert,
340 SCannotUpdate,
341 SCannotDelete,
342 SCannotRefresh,
343 SBufferNotSet,
344 SCircularReference,
345 SUserAbort,
346 SDataSetUniDirectional,
347 SCannotCreateSharedResource,
348 SFieldUnsupportedType,
349 SCircularDataLink,
350 SEmptySQLStatement,
351 SIsASelectStatement,
352 SRequiredParamNotSet,
353 SNoStoredProcName,
354 SIsAExecuteProcedure,
355 SUpdateFailed,
356 SNoRecordsAffected,
357 SNoTableName,
358 STableNameMismatch,
359 SIndexFieldMissing,
360 SInvalidEvent,
361 SMaximumEvents,
362 SInvalidBatchMove,
363 SSQLDialectInvalid,
364 SSPBConstantNotSupported,
365 SSPBConstantUnknown,
366 SServiceActive,
367 SServiceInActive,
368 SServerNameMissing,
369 SQueryParamsError,
370 SStartParamsError,
371 SOutputParsingError,
372 SUseSpecificProcedures,
373 SDPBConstantUnknownEx,
374 STPBConstantUnknownEx,
375 SSV5APIError,
376 SThreadFailed,
377 SFieldSizeError,
378 SNoLoginDialog,
379 SInfoBufferIndexError,
380 SServiceRequestIndexError,
381 SServiceParamTypeError,
382 SArrayBoundsCantIncrease,
383 SUnexpectedDatabaseInfoResp,
384 SStringTooLong,
385 SFieldNotinDataSet,
386 SNotCurrentArray,
387 SServiceRunning,
388 SUniqueRelationReqd,
389 SNegativeGenerator,
390 SServiceUnavailable,
391 SBadConnectString,
392 SServiceNotStarted,
393 SNotRequiredDataSetSource,
394 SNoLimboTransactionInsert,
395 SDatabaseNotConnected,
396 SMultiThreadRequired,
397 SODSVersionRequired,
398 SErrorParsing,
399 SParameterNameNotFound,
400 SListFieldNotFound
401 );
402
403 function GetErrorMessage(ErrMess: TIBClientError): AnsiString;
404 begin
405 Result := IBErrorMessages[ErrMess];
406 end;
407
408 procedure IBError(ErrMess: TIBClientError; const Args: array of const);
409 begin
410 raise EIBClientError.Create(Ord(ErrMess),
411 Format(GetErrorMessage(ErrMess), Args));
412 end;
413
414 end.
415