commit-gnue
[Top][All Lists]
Advanced

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

r6695 - trunk/gnue-common/src/datasources/drivers/Base


From: reinhard
Subject: r6695 - trunk/gnue-common/src/datasources/drivers/Base
Date: Wed, 17 Nov 2004 18:05:20 -0600 (CST)

Author: reinhard
Date: 2004-11-17 18:05:19 -0600 (Wed, 17 Nov 2004)
New Revision: 6695

Modified:
   trunk/gnue-common/src/datasources/drivers/Base/ResultSet.py
Log:
Added function to get some fields for the complete resultset in form of a
2-dimensional list.


Modified: trunk/gnue-common/src/datasources/drivers/Base/ResultSet.py
===================================================================
--- trunk/gnue-common/src/datasources/drivers/Base/ResultSet.py 2004-11-17 
23:53:53 UTC (rev 6694)
+++ trunk/gnue-common/src/datasources/drivers/Base/ResultSet.py 2004-11-18 
00:05:19 UTC (rev 6695)
@@ -244,6 +244,29 @@
         return self.current
 
   # ---------------------------------------------------------------------------
+  # Get data as array
+  # ---------------------------------------------------------------------------
+
+  def getArray (self, fields):
+    """
+    This function returns the values of the given fields for all records as a
+    2-dimensional list. The record pointer is *not* moved.
+    """
+
+    # First, load all records into the cache
+    while self._cacheNextRecord():
+      pass
+
+    # Now build up the array
+    result = []
+    for record in self._cachedRecords:
+      line = []
+      for field in fields:
+        line.append (record [field])
+      result.append (line)
+    return result
+
+  # ---------------------------------------------------------------------------
   # Close the result set
   # ---------------------------------------------------------------------------
 





reply via email to

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