Hello,

I've recently joined the db-sig ML, and I've read the threads about
the two phase commit interface design of Jan 2008.

I'd like to implement the DBAPI TPC extension in psycopg2: I'm
considering the best way to overcome the slight model difference
between the XA-inspired DBAPI and the PostgreSQL commands.

The DBAPI xid structure has members (format_id, gtrid, bqual). In
postgresql PREPARE TRANSACTION only takes a string "tid". So it will
be the driver's responsibility to map between the xid triple and the
tid string. I may come out with a separator (e.g. "|") and concatenate
the three parts into a tid, escaping the separator. On the other way
round, it wouldn't be a problem to perform the inverse split, but I
should take in consideration transactions whose tid doesn't follow the
pattern (e.g. created by a non-XA-oriented application) and is just
composed by a string. tpc_recover would then create xid with format_id
= 0 and bqual = "", that seem reasonable default values reading the XA
specs.

Is postgres the only database with this xid mapping issue? If other
dbs have similar issues, how is the xid - string mapping usually
performed?

Any other suggestion about the matter would be appreciated. Thank you.

-- Daniele
_______________________________________________
DB-SIG maillist  -  DB-SIG@python.org
http://mail.python.org/mailman/listinfo/db-sig

Reply via email to