commit-gnue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

r5654 - trunk/gnue-common/src/datasources/drivers/DBSIG2


From: reinhard
Subject: r5654 - trunk/gnue-common/src/datasources/drivers/DBSIG2
Date: Tue, 6 Apr 2004 13:24:13 -0500 (CDT)

Author: reinhard
Date: 2004-04-06 13:24:12 -0500 (Tue, 06 Apr 2004)
New Revision: 5654

Modified:
   trunk/gnue-common/src/datasources/drivers/DBSIG2/Connection.py
   trunk/gnue-common/src/datasources/drivers/DBSIG2/ResultSet.py
Log:
Added _broken_fetchmany option to ignore exceptions happening in fetchmany().


Modified: trunk/gnue-common/src/datasources/drivers/DBSIG2/Connection.py
===================================================================
--- trunk/gnue-common/src/datasources/drivers/DBSIG2/Connection.py      
2004-04-06 18:14:46 UTC (rev 5653)
+++ trunk/gnue-common/src/datasources/drivers/DBSIG2/Connection.py      
2004-04-06 18:24:12 UTC (rev 5654)
@@ -61,6 +61,8 @@
   _driver = None                        # DBSIG2 compatible driver module
   _boolean_false = '0'                  # value to pass for boolean FALSE
   _boolean_true  = '1'                  # value to pass for boolean TRUE
+  _broken_fetchmany = False             # Does fetchmany () raise an exception
+                                        # when no records are left?
 
   # This should be over-ridden only if driver needs more than user/pass
   def getLoginFields(self):

Modified: trunk/gnue-common/src/datasources/drivers/DBSIG2/ResultSet.py
===================================================================
--- trunk/gnue-common/src/datasources/drivers/DBSIG2/ResultSet.py       
2004-04-06 18:14:46 UTC (rev 5653)
+++ trunk/gnue-common/src/datasources/drivers/DBSIG2/ResultSet.py       
2004-04-06 18:24:12 UTC (rev 5654)
@@ -68,12 +68,18 @@
     if self._cursor:
       rs = None
 
-      try:
-        # this fixes the mysql-fetchmany-bug (< version 0.9.2) with a missing
-        # default size
-        rsets = self._cursor.fetchmany(self._cursor.arraysize)
-      except self._dataObject._DatabaseError, err:
-        raise Exceptions.ConnectionError, err
+      if self._dataObject._connection._broken_fetchmany:
+        try:
+          rsets = self._cursor.fetchmany ()
+        except:
+          rsets = None
+      else:
+        try:
+          # Pass arraysize because of mysql fetchmany bug in MySQLdb < 0.9.2
+          rsets = self._cursor.fetchmany (self._cursor.arraysize)
+        except self._dataObject._DatabaseError, err:
+          raise Exceptions.ConnectionError, err
+
       if rsets and len(rsets):
         for rs in(rsets):
           if rs:





reply via email to

[Prev in Thread] Current Thread [Next in Thread]