1 |
tony |
371 |
(*
|
2 |
|
|
* Firebird UDR Support (fbudr). The fbudr components provide a set of
|
3 |
|
|
* Pascal language bindings for the Firebird API in support of server
|
4 |
|
|
* side User Defined Routines (UDRs). The fbudr package is an extension
|
5 |
|
|
* to the Firebird Pascal API.
|
6 |
|
|
*
|
7 |
|
|
* The contents of this file are subject to the Initial Developer's
|
8 |
|
|
* Public License Version 1.0 (the "License"); you may not use this
|
9 |
|
|
* file except in compliance with the License. You may obtain a copy
|
10 |
|
|
* of the License here:
|
11 |
|
|
*
|
12 |
|
|
* http://www.firebirdsql.org/index.php?op=doc&id=idpl
|
13 |
|
|
*
|
14 |
|
|
* Software distributed under the License is distributed on an "AS
|
15 |
|
|
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
16 |
|
|
* implied. See the License for the specific language governing rights
|
17 |
|
|
* and limitations under the License.
|
18 |
|
|
*
|
19 |
|
|
* The Initial Developer of the Original Code is Tony Whyman.
|
20 |
|
|
*
|
21 |
|
|
* The Original Code is (C) 2021 Tony Whyman, MWA Software
|
22 |
|
|
* (http://www.mwasoftware.co.uk).
|
23 |
|
|
*
|
24 |
|
|
* All Rights Reserved.
|
25 |
|
|
*
|
26 |
|
|
* Contributor(s): ______________________________________.
|
27 |
|
|
*
|
28 |
|
|
*)
|
29 |
|
|
unit FBUDRMessage;
|
30 |
|
|
|
31 |
|
|
{$IFDEF MSWINDOWS}
|
32 |
|
|
{$DEFINE WINDOWS}
|
33 |
|
|
{$ENDIF}
|
34 |
|
|
|
35 |
|
|
{$IFDEF FPC}
|
36 |
|
|
{$mode delphi}
|
37 |
|
|
{$codepage UTF8}
|
38 |
|
|
{$interfaces COM}
|
39 |
|
|
{$ENDIF}
|
40 |
|
|
|
41 |
|
|
interface
|
42 |
|
|
|
43 |
|
|
uses
|
44 |
|
|
Classes, SysUtils;
|
45 |
|
|
|
46 |
|
|
type
|
47 |
|
|
TFBUDRError = (ibxeUnknownTriggerType,
|
48 |
|
|
ibxeUnknownTransactionAction,
|
49 |
|
|
ibxeNoTriggerMetadata,
|
50 |
|
|
ibxeInvalidFactoryObject,
|
51 |
|
|
ibxeNoProcMetadata
|
52 |
|
|
);
|
53 |
|
|
|
54 |
|
|
procedure FBUDRError(ErrMess: TFBUDRError; const Args: array of const);
|
55 |
|
|
|
56 |
|
|
resourcestring
|
57 |
|
|
{Messages used by other units}
|
58 |
|
|
SFirebirdStatusError = 'Firebird API Status returned Error Code';
|
59 |
|
|
|
60 |
|
|
implementation
|
61 |
|
|
|
62 |
|
|
uses IB;
|
63 |
|
|
|
64 |
|
|
resourcestring
|
65 |
|
|
SUnknownTriggerType = 'Unknown Trigger Type (%d)';
|
66 |
|
|
SUnknownTransactionAction = 'Unknown Trigger Action (%d)';
|
67 |
|
|
SNoTriggerMetadata = 'Unable to get interface IFBTriggerMetaData';
|
68 |
|
|
SInvalidFactoryObject = 'Entry Point %s: %s is not recognised factory class';
|
69 |
|
|
SNoProcMetadata = 'Unable to get interface IFBProcMetadata';
|
70 |
|
|
|
71 |
|
|
const
|
72 |
|
|
FBUDRErrorMessages: array[TFBUDRError] of string = (
|
73 |
|
|
SUnknownTriggerType,
|
74 |
|
|
SUnknownTransactionAction,
|
75 |
|
|
SNoTriggerMetadata,
|
76 |
|
|
SInvalidFactoryObject,
|
77 |
|
|
SNoProcMetadata
|
78 |
|
|
);
|
79 |
|
|
|
80 |
|
|
function GetErrorMessage(ErrMess: TFBUDRError): AnsiString;
|
81 |
|
|
begin
|
82 |
|
|
Result := FBUDRErrorMessages[ErrMess];
|
83 |
|
|
end;
|
84 |
|
|
|
85 |
|
|
|
86 |
|
|
procedure FBUDRError(ErrMess: TFBUDRError; const Args: array of const);
|
87 |
|
|
begin
|
88 |
|
|
raise EIBClientError.Create(Ord(ErrMess),
|
89 |
|
|
Format(GetErrorMessage(ErrMess), Args));
|
90 |
|
|
end;
|
91 |
|
|
|
92 |
|
|
end.
|
93 |
|
|
|