[Zope-Checkins] CVS: Products/DCOracle2/DCOracle2 - DCOracle2.py:1.92

Matthew T. Kromer matt@zope.com
Mon, 15 Jul 2002 10:13:22 -0400


Update of /cvs-repository/Products/DCOracle2/DCOracle2
In directory cvs.zope.org:/tmp/cvs-serv480/DCOracle2

Modified Files:
	DCOracle2.py 
Log Message:
Checkin slightly busted XID support from this weekend.  Unfortunately, using
XIDs seems to lead to invalid svchp handles, so it doesnt seem very useful.

Getting the transaction XID will work without problems; what doesnt work right
is doing a rollback/commit, setting an XID, and starting a new transaction.



=== Products/DCOracle2/DCOracle2/DCOracle2.py 1.91 => 1.92 ===
 
         return proc
 
+    # NONAPI
+    def getTransactionName(self):
+        """Returns the transaction name associated with the current
+           transaction, or None via the OCI_ATTR_TRANS_NAME attribute"""
+
+        trans = self._db.getTransaction()
+        if not trans: return None
+
+        return trans.name
+
+    # NONAPI
+    def setTransactionName(self, name):
+        """Sets the transaction name associated with the current
+           transaction, or None via the OCI_ATTR_TRANS_NAME attribute"""
+
+        trans = self._db.newTransaction()
+
+        name = str(name)        # XXX will wedge unicode names
+
+        if len(name) > 64:
+            raise ValueError, ('transaction name too long', name)
+
+        trans.setName(name)
+        self._db.setTransaction(trans)
+
+    # NONAPI
+    def getTransactionXID(self):
+        """Returns the transaction XID as a (format, globalid, branch qualifier)
+           tuple, or None if there is no transaction XID"""
+
+        trans = self._db.getTransaction()
+        if not trans: return None
+
+        return (trans.format, trans.gtrid, trans.bqual)
+
+    # NONAPI
+    def setTransactionXID(self, xid):
+        """Sets the transaction XID associated with the current
+           transaction.  XID is passed in as a tuple
+           (format, globalid, branch qualifier)"""
+
+        trans = self._db.newTransaction()
+
+        trans.setXID(xid[0], xid[1], xid[2])
+
+        self._db.setTransaction(trans)
+
 #
 # cursor objects
 #
@@ -1039,7 +1086,7 @@
             # XXX                                                 XXX
             # XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX
 
-            #baoa[c].setStatic(1)    # Mark this as a static binding
+            baoa[c].setStatic(1)    # Mark this as a static binding
 
             # ERROR -- this is too early for a normal binding array bind
             #self._cursor.bindbypos(c + 1, baoa[c])