plpy_subxactobject.c File Reference
Include dependency graph for plpy_subxactobject.c:
Go to the source code of this file.
Function Documentation
◆ PLy_subtransaction_enter()
static PyObject * PLy_subtransaction_enter
(
PyObject *
self,
PyObject *
unused
)
static
Definition at line 94 of file plpy_subxactobject.c.
95{
99
101 {
102 PLy_exception_set(PyExc_ValueError,
"this subtransaction has already been entered");
103 return NULL;
104 }
105
107 {
108 PLy_exception_set(PyExc_ValueError,
"this subtransaction has already been exited");
109 return NULL;
110 }
111
114
118
121
123
124 /* Be sure that cells of explicit_subtransactions list are long-lived */
127
128 /* Caller wants to stay in original memory context */
130
131 Py_INCREF(self);
132 return self;
133}
List * lcons(void *datum, List *list)
void * MemoryContextAlloc(MemoryContext context, Size size)
MemoryContext TopTransactionContext
MemoryContext CurrentMemoryContext
static MemoryContext MemoryContextSwitchTo(MemoryContext context)
void PLy_exception_set(PyObject *exc, const char *fmt,...)
List * explicit_subtransactions
ResourceOwner CurrentResourceOwner
PyObject_HEAD bool started
void BeginInternalSubTransaction(const char *name)
References BeginInternalSubTransaction(), CurrentMemoryContext, CurrentResourceOwner, PLySubtransactionObject::exited, explicit_subtransactions, lcons(), MemoryContextAlloc(), MemoryContextSwitchTo(), PLySubtransactionData::oldcontext, PLySubtransactionData::oldowner, PLy_exception_set(), PLySubtransactionObject::started, and TopTransactionContext.
◆ PLy_subtransaction_exit()
static PyObject * PLy_subtransaction_exit
(
PyObject *
self,
PyObject *
args
)
static
Definition at line 147 of file plpy_subxactobject.c.
148{
151 PyObject *traceback;
154
155 if (!PyArg_ParseTuple(
args,
"OOO", &
type, &
value, &traceback))
156 return NULL;
157
159 {
161 return NULL;
162 }
163
165 {
166 PLy_exception_set(PyExc_ValueError,
"this subtransaction has already been exited");
167 return NULL;
168 }
169
171 {
173 return NULL;
174 }
175
177
179 {
180 /* Abort the inner transaction */
182 }
183 else
184 {
186 }
187
190
194
195 Py_RETURN_NONE;
196}
List * list_delete_first(List *list)
void pfree(void *pointer)
void RollbackAndReleaseCurrentSubTransaction(void)
void ReleaseCurrentSubTransaction(void)
References generate_unaccent_rules::args, CurrentResourceOwner, PLySubtransactionObject::exited, explicit_subtransactions, linitial, list_delete_first(), MemoryContextSwitchTo(), NIL, PLySubtransactionData::oldcontext, PLySubtransactionData::oldowner, pfree(), PLy_exception_set(), ReleaseCurrentSubTransaction(), RollbackAndReleaseCurrentSubTransaction(), PLySubtransactionObject::started, type, and value.
◆ PLy_subtransaction_init_type()
void PLy_subtransaction_init_type
(
void
)
◆ PLy_subtransaction_new()
PyObject * PLy_subtransaction_new
(
PyObject *
self,
PyObject *
unused
)
Variable Documentation
◆ explicit_subtransactions
List* explicit_subtransactions =
NIL
◆ PLy_subtransaction_doc
char PLy_subtransaction_doc[]
static
Initial value:=
"PostgreSQL subtransaction context manager"
Definition at line 21 of file plpy_subxactobject.c.
◆ PLy_subtransaction_methods
PyMethodDef PLy_subtransaction_methods[]
static
Initial value:= {
{NULL, NULL, 0, NULL}
}
static PyObject * PLy_subtransaction_exit(PyObject *self, PyObject *args)
static PyObject * PLy_subtransaction_enter(PyObject *self, PyObject *unused)
Definition at line 24 of file plpy_subxactobject.c.
◆ PLy_SubtransactionType
PyTypeObject* PLy_SubtransactionType
static
◆ PLySubtransaction_slots
PyType_Slot PLySubtransaction_slots[]
static
Initial value:=
{
{
},
{
},
{
0, NULL
}
}
static PyMethodDef PLy_subtransaction_methods[]
static char PLy_subtransaction_doc[]
Definition at line 33 of file plpy_subxactobject.c.
◆ PLySubtransaction_spec
PyType_Spec PLySubtransaction_spec
static
Initial value:=
{
.name = "PLySubtransaction",
.flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
}
static PyType_Slot PLySubtransaction_slots[]
struct PLySubtransactionObject PLySubtransactionObject
Definition at line 46 of file plpy_subxactobject.c.
Referenced by PLy_subtransaction_init_type().