diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2006-10-12 17:02:12 +0000 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2006-10-12 17:02:12 +0000 |
| commit | c934ae44a84fd94d805b341bfba68308e82c2384 (patch) | |
| tree | 3f71d758c1ac45c6c55c02949bcba4144f0289c2 /lib/sqlalchemy | |
| parent | e16bfad40756e76bf4622eaeb005983a4300f32e (diff) | |
| download | sqlalchemy-c934ae44a84fd94d805b341bfba68308e82c2384.tar.gz | |
- ResultProxy.fetchall() internally uses DBAPI fetchall() for better efficiency,
added to mapper iteration as well (courtesy Michael Twomey)
Diffstat (limited to 'lib/sqlalchemy')
| -rw-r--r-- | lib/sqlalchemy/engine/base.py | 9 | ||||
| -rw-r--r-- | lib/sqlalchemy/orm/mapper.py | 5 |
2 files changed, 5 insertions, 9 deletions
diff --git a/lib/sqlalchemy/engine/base.py b/lib/sqlalchemy/engine/base.py index 79a1909d1..4251c5810 100644 --- a/lib/sqlalchemy/engine/base.py +++ b/lib/sqlalchemy/engine/base.py @@ -632,11 +632,10 @@ class ResultProxy: def fetchall(self): """fetch all rows, just like DBAPI cursor.fetchall().""" l = [] - while True: - v = self.fetchone() - if v is None: - return l - l.append(v) + for row in self.cursor.fetchall(): + l.append(RowProxy(self, row)) + self.close() + return l def fetchone(self): """fetch one row, just like DBAPI cursor.fetchone().""" diff --git a/lib/sqlalchemy/orm/mapper.py b/lib/sqlalchemy/orm/mapper.py index 57c29a630..096e1ca33 100644 --- a/lib/sqlalchemy/orm/mapper.py +++ b/lib/sqlalchemy/orm/mapper.py @@ -659,10 +659,7 @@ class Mapper(object): for m in mappers: otherresults.append(util.UniqueAppender([])) - while True: - row = cursor.fetchone() - if row is None: - break + for row in cursor.fetchall(): self._instance(context, row, result) i = 0 for m in mappers: |
