commit-gnue
[Top][All Lists]
Advanced

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

[gnue] r7273 - trunk/gnue-common/src/datasources/drivers/DBSIG2


From: reinhard
Subject: [gnue] r7273 - trunk/gnue-common/src/datasources/drivers/DBSIG2
Date: Tue, 29 Mar 2005 12:41:45 -0600 (CST)

Author: reinhard
Date: 2005-03-29 12:41:43 -0600 (Tue, 29 Mar 2005)
New Revision: 7273

Modified:
   trunk/gnue-common/src/datasources/drivers/DBSIG2/Connection.py
   trunk/gnue-common/src/datasources/drivers/DBSIG2/DataObject.py
Log:
Implemented new option "_broken_rowcount" for dbdrivers where cursor.rowcount
can't be used.


Modified: trunk/gnue-common/src/datasources/drivers/DBSIG2/Connection.py
===================================================================
--- trunk/gnue-common/src/datasources/drivers/DBSIG2/Connection.py      
2005-03-29 15:23:37 UTC (rev 7272)
+++ trunk/gnue-common/src/datasources/drivers/DBSIG2/Connection.py      
2005-03-29 18:41:43 UTC (rev 7273)
@@ -52,8 +52,10 @@
   @cvar _boolean_true: Value to post to the database for boolean TRUE
     (defaults to '1'). Can be overwritten by descendants.
   @cvar _broken_fetchmany: Can be set to True by descendants if the DBSIG2
-    driver raises an exception if fetchmany() is called when no records are
+    module raises an exception if fetchmany() is called when no records are
     left.
+  @cvar _broken_rowcount: Can be set to True by descendants if the DBSIG2
+    module does not return a correct value for cursor.rowcount.
   @cvar _numbers_as_string: Flags wether to convert numbers to strings or not.
     Can be overwritten by descendants.
   @cvar _named_as_sequence: If paramstyle = 'named' pass parameters as
@@ -65,6 +67,7 @@
   _boolean_true  = '1'                  # value to pass for boolean TRUE
   _broken_fetchmany = False             # Does fetchmany () raise an exception
                                         # when no records are left?
+  _broken_rowcount = False              # Is cursor.rowcount unusable?
   _numbers_as_string = True             # Convert numbers into strings
   _named_as_sequence = False            # Pass 'named' parameters as sequence
 

Modified: trunk/gnue-common/src/datasources/drivers/DBSIG2/DataObject.py
===================================================================
--- trunk/gnue-common/src/datasources/drivers/DBSIG2/DataObject.py      
2005-03-29 15:23:37 UTC (rev 7272)
+++ trunk/gnue-common/src/datasources/drivers/DBSIG2/DataObject.py      
2005-03-29 18:41:43 UTC (rev 7273)
@@ -94,10 +94,6 @@
 
     gDebug (8, "DB-SIG database driver backend initializing")
 
-
-    # TODO: uh, hmm..
-    self._strictQueryCount = True   # strictQueryCount
-
     self.distinct = False
 
     # If possible, this will contain the field names used in the last select
@@ -166,20 +162,15 @@
       cursor = self._connection.makecursor(query)
       cursor.arraysize = self.cache
 
-      # pull a record count
-      if self._strictQueryCount:
-        recordCount = cursor.rowcount
-        #disable the count query and see if anyone screams.
-        #recordCount = self._getQueryCount(conditions,sql)
-        #  ARGH!!!! Oh, the agony... the agony....
-
     except self._DatabaseError:
       raise Exceptions.ConnectionError, errors.getException () [2]
 
     rs = self._resultSetClass(self, cursor=cursor, 
masterRecordSet=masterRecordSet,
        fieldOrder=self._fieldOrder)
-    if self._strictQueryCount:
-      rs._recordCount = recordCount
+
+    if self._connection._broken_rowcount:
+      rs._recordCount = self._getQueryCount(conditions,sql)
+
     if readOnly:
       rs._readonly = readOnly
 





reply via email to

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