1 | /* |
2 | * The contents of this file are subject to the Interbase Public |
3 | * License Version 1.0 (the "License"); you may not use this file |
4 | * except in compliance with the License. You may obtain a copy |
5 | * of the License at http://www.Inprise.com/IPL.html |
6 | * |
7 | * Software distributed under the License is distributed on an |
8 | * "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express |
9 | * or implied. See the License for the specific language governing |
10 | * rights and limitations under the License. |
11 | * |
12 | * The Original Code was created by Inprise Corporation |
13 | * and its predecessors. Portions created by Inprise Corporation are |
14 | * Copyright (C) Inprise Corporation. |
15 | * |
16 | * All Rights Reserved. |
17 | * Contributor(s): ______________________________________. |
18 | */ |
19 | |
20 | #ifndef JRD_FUNCTION_H |
21 | #define JRD_FUNCTION_H |
22 | |
23 | #include "../jrd/Routine.h" |
24 | #include "../common/classes/array.h" |
25 | #include "../common/dsc.h" |
26 | #include "../common/classes/NestConst.h" |
27 | #include "../jrd/val.h" |
28 | #include "../dsql/Nodes.h" |
29 | |
30 | namespace Jrd |
31 | { |
32 | class ValueListNode; |
33 | |
34 | class Function : public Routine |
35 | { |
36 | static const char* const EXCEPTION_MESSAGE; |
37 | |
38 | public: |
39 | static Function* lookup(thread_db* tdbb, USHORT id, bool return_deleted, bool noscan, USHORT flags); |
40 | static Function* lookup(thread_db* tdbb, const Firebird::QualifiedName& name, bool noscan); |
41 | |
42 | void releaseLocks(thread_db* tdbb); |
43 | |
44 | explicit Function(MemoryPool& p) |
45 | : Routine(p), |
46 | fun_entrypoint(NULL), |
47 | fun_inputs(0), |
48 | fun_return_arg(0), |
49 | fun_temp_length(0), |
50 | fun_exception_message(p), |
51 | fun_deterministic(false), |
52 | fun_external(NULL) |
53 | { |
54 | } |
55 | |
56 | static Function* loadMetadata(thread_db* tdbb, USHORT id, bool noscan, USHORT flags); |
57 | static int blockingAst(void*); |
58 | |
59 | public: |
60 | virtual int getObjectType() const |
61 | { |
62 | return obj_udf; |
63 | } |
64 | |
65 | virtual SLONG getSclType() const |
66 | { |
67 | return SCL_object_function; |
68 | } |
69 | |
70 | virtual bool checkCache(thread_db* tdbb) const; |
71 | virtual void clearCache(thread_db* tdbb); |
72 | |
73 | public: |
74 | int (*fun_entrypoint)(); // function entrypoint |
75 | USHORT fun_inputs; // input arguments |
76 | USHORT fun_return_arg; // return argument |
77 | ULONG fun_temp_length; // temporary space required |
78 | |
79 | Firebird::string fun_exception_message; // message containing the exception error message |
80 | |
81 | bool fun_deterministic; |
82 | const ExtEngineManager::Function* fun_external; |
83 | }; |
84 | } |
85 | |
86 | #endif // JRD_FUNCTION_H |
87 | |