1/*
2 * The contents of this file are subject to the Initial
3 * Developer's Public License Version 1.0 (the "License");
4 * you may not use this file except in compliance with the
5 * License. You may obtain a copy of the License at
6 * http://www.ibphoenix.com/main.nfs?a=ibphoenix&page=ibp_idpl.
7 *
8 * Software distributed under the License is distributed AS IS,
9 * WITHOUT WARRANTY OF ANY KIND, either express or implied.
10 * See the License for the specific language governing rights
11 * and limitations under the License.
12 *
13 * The Original Code was created by Adriano dos Santos Fernandes
14 * for the Firebird Open Source RDBMS project.
15 *
16 * Copyright (c) 2008 Adriano dos Santos Fernandes <adrianosf@uol.com.br>
17 * and all contributors signed below.
18 *
19 * All Rights Reserved.
20 * Contributor(s): ______________________________________.
21 */
22
23#ifndef FIREBIRD_UDR_H
24#define FIREBIRD_UDR_H
25
26#include "./ExternalEngine.h"
27
28
29namespace Firebird
30{
31 namespace Udr
32 {
33//------------------------------------------------------------------------------
34
35
36// Factory classes. They should be singletons instances created by user's modules and
37// registered. When UDR engine is going to load a routine, it calls newItem.
38
39class FunctionFactory
40{
41public:
42 virtual void FB_CARG setup(IStatus* status, ExternalContext* context, const IRoutineMetadata* metadata,
43 IMetadataBuilder* inBuilder, IMetadataBuilder* outBuilder) = 0;
44 virtual ExternalFunction* FB_CARG newItem(IStatus* status, ExternalContext* context,
45 const IRoutineMetadata* metadata) = 0;
46};
47
48class ProcedureFactory
49{
50public:
51 virtual void FB_CARG setup(IStatus* status, ExternalContext* context, const IRoutineMetadata* metadata,
52 IMetadataBuilder* inBuilder, IMetadataBuilder* outBuilder) = 0;
53 virtual ExternalProcedure* FB_CARG newItem(IStatus* status, ExternalContext* context,
54 const IRoutineMetadata* metadata) = 0;
55};
56
57class TriggerFactory
58{
59public:
60 virtual void FB_CARG setup(IStatus* status, ExternalContext* context, const IRoutineMetadata* metadata,
61 IMetadataBuilder* fieldsBuilder) = 0;
62 virtual ExternalTrigger* FB_CARG newItem(IStatus* status, ExternalContext* context,
63 const IRoutineMetadata* metadata) = 0;
64};
65
66
67// Routine registration functions.
68extern "C" void fbUdrRegFunction(const char* name, FunctionFactory* factory);
69extern "C" void fbUdrRegProcedure(const char* name, ProcedureFactory* factory);
70extern "C" void fbUdrRegTrigger(const char* name, TriggerFactory* factory);
71
72
73//------------------------------------------------------------------------------
74 } // namespace Udr
75} // namespace Firebird
76
77#endif // FIREBIRD_UDR_H
78