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

Matthew T. Kromer matt@zope.com
Tue, 14 May 2002 15:16:43 -0400


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

Modified Files:
	DCOracle2.py 
Log Message:
Add BLOB/CLOB handing to stored procs, re collector issue #40.  Instead of
allocating a BindingArray for the OUT variables which are LOBs, a LobLocator
is allocated instead.  This doesn't support array output of LOBs, however.


=== Products/DCOracle2/DCOracle2/DCOracle2.py 1.87 => 1.88 ===
         return apply(self._db.BindingArray,args)
 
+    # NONAPI
+    def LobLocator(self,*args):
+        """Allocate an empty lob locator -- used for SP invocation"""
+        return apply(self._db.LobLocator,args)
+
     # API pass-through for internal cursor
     def __getattr__(self, name):
         d = self.__dict__
@@ -1369,6 +1374,13 @@
                         count = cursor._sizes[i] or DEFAULTPROCCOUNT
                     else:
                         count = DEFAULTPROCCOUNT
+                elif ((dty == 112 or dty == 113) and
+                    type(thisargValue) is not dco2.LobLocatorType):
+                    # BLOB/CLOB coming out, so make a locator element
+                    # (doesnt handle an array of BLOBS)
+                    thisargValue = cursor._connection.LobLocator(dty)
+                    a[0] = thisargValue
+                    break   # Not a binding array, but a lob locator
 
                 if dty == 102:  # SQLT_CUR
                     dty = 'SQLT_RSET'
@@ -1380,7 +1392,7 @@
 
                 #print "Creating new BindingArray of size %s, type %s" % (l, dty)
                 ba = cursor._connection.BindingArray(count, l, dty)
-                olda = a[0]
+                olda = thisargValue
                 a[0] = ba  # Swap in our new binding array for the output
 
                 # I'm not going to worry about arrays of cursors going in
@@ -1397,6 +1409,7 @@
                     ba[0] = olda      # FIXME doesnt do the array case
                     ba = self._argconvertIn(ba, argconvert, i)
                     a[0] = ba         # Resave new arg
+
 
         #print argmap