mirror of
https://github.com/psycopg/psycopg2.git
synced 2025-02-07 12:50:32 +03:00
begin and commit can't be called during a two-phase transaction.
This commit is contained in:
parent
98c5b1d374
commit
4588fa50f2
|
@ -143,6 +143,11 @@ HIDDEN int conn_tpc_begin(connectionObject *self, XidObject *xid);
|
|||
"in asynchronous mode"); \
|
||||
return NULL; }
|
||||
|
||||
#define EXC_IF_TPC_BEGIN(self, cmd) if ((self)->tpc_xid) { \
|
||||
PyErr_Format(ProgrammingError, "%s cannot be used " \
|
||||
"during a two-phase transaction", #cmd); \
|
||||
return NULL; }
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -137,6 +137,7 @@ psyco_conn_commit(connectionObject *self, PyObject *args)
|
|||
{
|
||||
EXC_IF_CONN_CLOSED(self);
|
||||
EXC_IF_CONN_ASYNC(self, commit);
|
||||
EXC_IF_TPC_BEGIN(self, commit);
|
||||
|
||||
if (!PyArg_ParseTuple(args, "")) return NULL;
|
||||
|
||||
|
@ -158,6 +159,7 @@ psyco_conn_rollback(connectionObject *self, PyObject *args)
|
|||
{
|
||||
EXC_IF_CONN_CLOSED(self);
|
||||
EXC_IF_CONN_ASYNC(self, rollback);
|
||||
EXC_IF_TPC_BEGIN(self, rollback);
|
||||
|
||||
if (!PyArg_ParseTuple(args, "")) return NULL;
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user