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

Matthew T. Kromer matt@zope.com
Thu, 13 Feb 2003 19:01:51 -0500


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

Modified Files:
	DCOracle2.py 
Log Message:
DB API 2.0 test suite compatibility fixes


=== Products/DCOracle2/DCOracle2/DCOracle2.py 1.99 => 1.100 ===
--- Products/DCOracle2/DCOracle2/DCOracle2.py:1.99	Wed Feb  5 10:19:31 2003
+++ Products/DCOracle2/DCOracle2/DCOracle2.py	Thu Feb 13 19:01:19 2003
@@ -133,6 +133,10 @@
 
 DateConversion = None 
 
+# This is the list of operations where the result row count is good aftewards
+# note that SELECT doesn't return a rowcount
+RowCountResults = (2, 3, 4)
+
 # For the next() idiom which is Python 2.2, there is no StopIteration in
 # earlier pythons
 
@@ -288,6 +292,7 @@
     def close(self):
         if self._cursor:
             self._cursor.close()
+        self._db.close()
         d = self.__dict__   # Work around __setattr__ hook
         del d['_cursor'] 
         d['_db'] = None
@@ -999,7 +1004,10 @@
                 self._cursor.bindbyname(ck, p)
 
         result = self._cursor.execute()
-        self.rowcount = self._cursor.rowcount()
+        if result in RowCountResults:
+            self.rowcount = self._cursor.rowcount()
+        else:
+            self.rowcount = -1
         self.description = self.describe()
         if result == 8:
             so = "PROC: %s" % self._operation
@@ -1201,10 +1209,12 @@
 
         return l
         
-    def fetchmany(self, size=arraysize, skip=0):
+    def fetchmany(self, size=None, skip=0):
         if self._cursor is None:
             raise InterfaceError,"cursor is closed"
         a = []
+
+        if size is None: size = self.arraysize
 
         # Wisdom: using range(0,size) is bad when size comes in from the
         # default query as 999999