ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/public/ibx/trunk/runtime/nongui/IBMessages.pas
Revision: 345
Committed: Mon Aug 23 14:22:29 2021 UTC (2 years, 8 months ago) by tony
Content type: text/x-pascal
File size: 16894 byte(s)
Log Message:
Merged into public release

File Contents

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