diff options
author | Daniele Varrazzo <daniele.varrazzo@gmail.com> | 2011-04-26 19:18:39 +0100 |
---|---|---|
committer | Daniele Varrazzo <daniele.varrazzo@gmail.com> | 2011-04-26 19:18:39 +0100 |
commit | ffa7a62b9313b52af0c70f61b888703de1491777 (patch) | |
tree | e6377648637c4a902b013f4aeb6ac2ce8f800e65 /lib/extras.py | |
parent | 80891e64b3f0280cfa28eba18b40d8b25bb0d284 (diff) | |
download | psycopg2-ffa7a62b9313b52af0c70f61b888703de1491777.tar.gz |
Fixed interaction between NamedTuple and named cursor
Build the nametuple after fetching the first resutl, or else
cursor.description will be empty.
Diffstat (limited to 'lib/extras.py')
-rw-r--r-- | lib/extras.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/extras.py b/lib/extras.py index 06d3657..dcbd65e 100644 --- a/lib/extras.py +++ b/lib/extras.py @@ -290,17 +290,17 @@ class NamedTupleCursor(_cursor): return nt(*t) def fetchmany(self, size=None): + ts = _cursor.fetchmany(self, size) nt = self.Record if nt is None: nt = self.Record = self._make_nt() - ts = _cursor.fetchmany(self, size) return [nt(*t) for t in ts] def fetchall(self): + ts = _cursor.fetchall(self) nt = self.Record if nt is None: nt = self.Record = self._make_nt() - ts = _cursor.fetchall(self) return [nt(*t) for t in ts] def __iter__(self): |