summaryrefslogtreecommitdiff
path: root/psycopg/psycopgmodule.c
diff options
context:
space:
mode:
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>2010-10-06 01:09:17 +0100
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>2010-11-05 09:34:47 +0000
commit0021e56d800dffbb7fa30fbb3349a1016456343e (patch)
tree77bbdecd0823693b8faf6b58977af9bbd2fa8fb7 /psycopg/psycopgmodule.c
parente863222b5c2d800c7cd5b72dac8efeaec0302e4f (diff)
downloadpsycopg2-0021e56d800dffbb7fa30fbb3349a1016456343e.tar.gz
Added connection.xid() and related objects.
By James Henstridge on 2008-07-23. Merged from lp:~jamesh/psycopg/two-phase-commit/revision/356 * psycopg/connection_type.c (psyco_conn_xid): add a Connection.xid() method that instantiates Xid objects. * psycopg/psycopgmodule.c (init_psycopg): initialise the Xid object type. * psycopg/xid.h: * psycopg/xid_type.c: Implement a basic transaction ID object for use in two phase commit.
Diffstat (limited to 'psycopg/psycopgmodule.c')
-rw-r--r--psycopg/psycopgmodule.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/psycopg/psycopgmodule.c b/psycopg/psycopgmodule.c
index 1e5f840..2fff724 100644
--- a/psycopg/psycopgmodule.c
+++ b/psycopg/psycopgmodule.c
@@ -35,6 +35,7 @@
#include "psycopg/green.h"
#include "psycopg/lobject.h"
#include "psycopg/notify.h"
+#include "psycopg/xid.h"
#include "psycopg/typecast.h"
#include "psycopg/microprotocols.h"
#include "psycopg/microprotocols_proto.h"
@@ -734,6 +735,7 @@ init_psycopg(void)
listType.ob_type = &PyType_Type;
chunkType.ob_type = &PyType_Type;
NotifyType.ob_type = &PyType_Type;
+ XidType.ob_type = &PyType_Type;
if (PyType_Ready(&connectionType) == -1) return;
if (PyType_Ready(&cursorType) == -1) return;
@@ -748,6 +750,7 @@ init_psycopg(void)
if (PyType_Ready(&listType) == -1) return;
if (PyType_Ready(&chunkType) == -1) return;
if (PyType_Ready(&NotifyType) == -1) return;
+ if (PyType_Ready(&XidType) == -1) return;
#ifdef PSYCOPG_EXTENSIONS
lobjectType.ob_type = &PyType_Type;
@@ -855,6 +858,7 @@ init_psycopg(void)
chunkType.tp_alloc = PyType_GenericAlloc;
pydatetimeType.tp_alloc = PyType_GenericAlloc;
NotifyType.tp_alloc = PyType_GenericAlloc;
+ XidType.tp_alloc = PyType_GenericAlloc;
#ifdef PSYCOPG_EXTENSIONS
lobjectType.tp_alloc = PyType_GenericAlloc;