forked from tada/pljava
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInvocation.h
More file actions
114 lines (89 loc) · 2.8 KB
/
Copy pathInvocation.h
File metadata and controls
114 lines (89 loc) · 2.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
/*
* Copyright (c) 2004, 2005, 2006 TADA AB - Taby Sweden
* Distributed under the terms shown in the file COPYRIGHT
* found in the root folder of this project or at
* http://eng.tada.se/osprojects/COPYRIGHT.html
*
* @author Thomas Hallgren
*/
#ifndef __pljava_Invocation_h
#define __pljava_Invocation_h
#include <postgres.h>
#include "pljava/pljava.h"
#ifdef __cplusplus
extern "C" {
#endif
struct CallLocal_;
typedef struct CallLocal_ CallLocal;
struct Invocation_
{
/**
* A Java object representing the current invocation. This
* field will be NULL if no such object has been requested.
*/
jobject invocation;
/**
* The context to use when allocating values that are to be
* returned from the call.
*/
MemoryContext upperContext;
/**
* Set when an SPI_connect is issued. Ensures that SPI_finish
* is called when the function exits.
*/
bool hasConnected;
/**
* Set to true if the call originates from an ExprContextCallback. When
* it does, we should not close any cursors.
*/
bool inExprContextCB;
/**
* Set to true if the executing function is trusted
*/
bool trusted;
/**
* The currently executing Function.
*/
Function function;
/**
* Set to true if an elog with a severity >= ERROR
* has occured. All calls from Java to the backend will
* be prevented until this flag is reset (by a rollback
* of a savepoint or function exit).
*/
bool errorOccured;
/**
* List of call local structures that has been wrapped
* during this invocation.
*/
CallLocal* callLocals;
/**
* The previous call context when nested function calls
* are made or 0 if this call is at the top level.
*/
Invocation* previous;
};
extern Invocation* currentInvocation;
extern void Invocation_assertConnect(void);
extern void Invocation_assertDisconnect(void);
extern void Invocation_pushBootContext(Invocation* ctx);
extern void Invocation_popBootContext(void);
extern void Invocation_pushInvocation(Invocation* ctx, bool trusted);
extern void Invocation_popInvocation(bool wasException);
extern jlong Invocation_createLocalWrapper(void* pointer);
extern void* Invocation_getWrappedPointer(jlong wrapper);
extern void Invocation_freeLocalWrapper(jlong wrapper);
extern jobject Invocation_getTypeMap(void);
/*
* Switch memory context to a context that is durable between calls to
* the call manager but not durable between queries. The old context is
* returned. This method can be used when creating values that will be
* returned from the Pl/Java routines. Once the values have been created
* a call to MemoryContextSwitchTo(oldContext) must follow where oldContext
* is the context returned from this call.
*/
extern MemoryContext Invocation_switchToUpperContext(void);
#ifdef __cplusplus
}
#endif
#endif /* !__pljava_Invocation_h */