mirror of https://github.com/django/django.git
Replaced Oracle CursorIterator with generator expression.
This commit is contained in:
parent
37b2602c89
commit
18db55bb31
|
@ -524,23 +524,7 @@ class FormatStylePlaceholderCursor:
|
||||||
return getattr(self.cursor, attr)
|
return getattr(self.cursor, attr)
|
||||||
|
|
||||||
def __iter__(self):
|
def __iter__(self):
|
||||||
return CursorIterator(self.cursor)
|
return (_rowfactory(r, self.cursor) for r in self.cursor)
|
||||||
|
|
||||||
|
|
||||||
class CursorIterator:
|
|
||||||
"""
|
|
||||||
Cursor iterator wrapper that invokes our custom row factory.
|
|
||||||
"""
|
|
||||||
|
|
||||||
def __init__(self, cursor):
|
|
||||||
self.cursor = cursor
|
|
||||||
self.iter = iter(cursor)
|
|
||||||
|
|
||||||
def __iter__(self):
|
|
||||||
return self
|
|
||||||
|
|
||||||
def __next__(self):
|
|
||||||
return _rowfactory(next(self.iter), self.cursor)
|
|
||||||
|
|
||||||
|
|
||||||
def _rowfactory(row, cursor):
|
def _rowfactory(row, cursor):
|
||||||
|
|
Loading…
Reference in New Issue