Author: johannes
Date: 2005-04-20 02:14:29 -0500 (Wed, 20 Apr 2005)
New Revision: 7430

Modified:
   trunk/gnue-common/src/datasources/drivers/DBSIG2/ResultSet.py
Log:
Change the order of queries for broken_rowcount


Modified: trunk/gnue-common/src/datasources/drivers/DBSIG2/ResultSet.py
===================================================================
--- trunk/gnue-common/src/datasources/drivers/DBSIG2/ResultSet.py       
2005-04-20 07:06:01 UTC (rev 7429)
+++ trunk/gnue-common/src/datasources/drivers/DBSIG2/ResultSet.py       
2005-04-20 07:14:29 UTC (rev 7430)
@@ -91,16 +91,20 @@
       what = 'DISTINCT ' + what
     where = condition.asSQL (params)
 
-    query = self.__buildQuery (table, what, where, sortorder)
-    self.__cursor = connection.makecursor (query, params)
-
+    # If the connection has a broken row count, query for the number of records
+    # first. This avoids conflicts with some drivers not supporting multiple
+    # open cursors (like adodbapi).
     if connection._broken_rowcount:
       if distinct:
         self.__count = 0
       else:
         query = self.__buildQueryCount (table, where)
         self.__count = connection.sql1 (query, params)
-    else:
+
+    query = self.__buildQuery (table, what, where, sortorder)
+    self.__cursor = connection.makecursor (query, params)
+
+    if not connection._broken_rowcount:
       self.__count = self.__cursor.rowcount
 
     self.__connection = connection



_______________________________________________
Commit-gnue mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/commit-gnue

Reply via email to