As requested by Gordon den Otter, return a boolean from connection.prepare()
indicating whether or not a transaction has been prepared for commit so that the error ORA-24756 (transaction does not exist) can be avoided.
This commit is contained in:
parent
15cbc242cb
commit
bd5915a435
13
Connection.c
13
Connection.c
@ -1322,10 +1322,17 @@ static PyObject *Connection_Prepare(
|
|||||||
if (Environment_CheckForError(self->environment, status,
|
if (Environment_CheckForError(self->environment, status,
|
||||||
"Connection_Prepare()") < 0)
|
"Connection_Prepare()") < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
self->commitMode = OCI_TRANS_TWOPHASE;
|
|
||||||
|
|
||||||
Py_INCREF(Py_None);
|
// if nothing available to prepare, return False in order to allow for
|
||||||
return Py_None;
|
// avoiding the call to commit() which will fail with ORA-24756
|
||||||
|
// (transaction does not exist)
|
||||||
|
if (status == OCI_SUCCESS_WITH_INFO) {
|
||||||
|
Py_INCREF(Py_False);
|
||||||
|
return Py_False;
|
||||||
|
}
|
||||||
|
self->commitMode = OCI_TRANS_TWOPHASE;
|
||||||
|
Py_INCREF(Py_True);
|
||||||
|
return Py_True;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user