]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- added "fetchmany()" support to ResultProxy
authorMike Bayer <mike_mp@zzzcomputing.com>
Thu, 11 Jan 2007 00:27:45 +0000 (00:27 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Thu, 11 Jan 2007 00:27:45 +0000 (00:27 +0000)
CHANGES
lib/sqlalchemy/engine/base.py

diff --git a/CHANGES b/CHANGES
index 99d1316fad6edbeb813cccf1e17e85ae7aadd48e..ad4c72f422fab7d4fbaf38ef52d6cb373f06cf99 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -8,6 +8,7 @@
   - postgres no longer uses client-side cursors, uses more efficient server side 
   cursors via apparently undocumented psycopg2 behavior recently discovered on the 
   mailing list.  disable it via create_engine('postgres://', client_side_cursors=True)
+  - added "fetchmany()" support to ResultProxy
   - added "BIGSERIAL" support for postgres table with PGBigInteger/autoincrement
   - fixes to postgres reflection to better handle when schema names are present;
   thanks to jason (at) ncsmags.com [ticket:402]
index 7fcf52af6d7161b8a7373481e54ddb92a034dbb6..65f2b5586be078aa082287fc3f80ab762372e825 100644 (file)
@@ -676,6 +676,19 @@ class ResultProxy(object):
         self.close()
         return l
             
+    def fetchmany(self, size=None):
+        """fetch many rows, juts like DBAPI cursor.fetchmany(size=cursor.arraysize)"""
+        if size is None:
+            rows = self.cursor.fetchmany()
+        else:
+            rows = self.cursor.fetchmany(size=size)
+        l = []
+        for row in rows:
+            l.append(RowProxy(self, row))
+        if len(l) == 0:
+            self.close()
+        return l
+        
     def fetchone(self):
         """fetch one row, just like DBAPI cursor.fetchone()."""
         row = self.cursor.fetchone()