DictCursor now support iteration.

This commit is contained in:
Federico Di Gregorio 2006-03-08 01:03:19 +00:00
parent 559149824b
commit 27a063fecb
2 changed files with 12 additions and 1 deletions

View File

@ -1,3 +1,7 @@
2006-03-08 Federico Di Gregorio <fog@initd.org>
* lib/extras.py: added .next() to DictCursot to support iteration.
2006-03-02 Federico Di Gregorio <fog@initd.org>
* psycopg/typecast_array.c (typecast_array_tokenize): removed cast

View File

@ -76,7 +76,14 @@ class DictCursor(_cursor):
if self.__query_executed:
self._build_index()
return res
def next(self):
res = _cursor.fetchone(self)
if res is None:
raise StopIteration()
if self.__query_executed:
self._build_index()
return res
class DictRow(list):
"""A row object that allow by-colun-name access to data."""