[Zope3-checkins] CVS: Zope3/lib/python/Zope/App/RDB - Util.py:1.5

Stephan Richter srichter@cbu.edu
Thu, 8 Aug 2002 13:07:03 -0400


Update of /cvs-repository/Zope3/lib/python/Zope/App/RDB
In directory cvs.zope.org:/tmp/cvs-serv8204

Modified Files:
	Util.py 
Log Message:
Unbelievable I missed that one. Now the method will pass, even if no SELECT statement was sent.


=== Zope3/lib/python/Zope/App/RDB/Util.py 1.4 => 1.5 ===
--- Zope3/lib/python/Zope/App/RDB/Util.py:1.4	Fri Jul 12 17:37:35 2002
+++ Zope3/lib/python/Zope/App/RDB/Util.py	Thu Aug  8 13:07:03 2002
@@ -29,11 +29,17 @@
     except Exception, error:
         raise DatabaseException(str(error))
 
-    columns = [c[0] for c in cursor.description]
+    if cursor.description is not None:
+        columns = [c[0] for c in cursor.description]
+        results = cursor.fetchall()
+    else:
+        # Handle the case that the query was not a SELECT
+        columns = []
+        results = []
 
     row_klass = RowClassFactory(columns)
     
-    return ResultSet(columns, cursor.fetchall(), row_klass)
+    return ResultSet(columns, results, row_klass)