ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/public/ibx/trunk/runtime/nongui/IBMessages.pas
Revision: 328
Committed: Fri Feb 26 09:33:18 2021 UTC (3 years, 8 months ago) by tony
Content type: text/x-pascal
File size: 16732 byte(s)
Log Message:
Add missing files

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