Subject Re: [firebird-python] How do i build the documentation ?
Author Pavel Cisar
Dne 11.11.2011 16:56, mariuz napsal(a):
> Thanks i have started with the tutorial and testing the examples from it
>>>> con = firebirdsql.connect(dsn='localhost:/tmp/test.fdb', user='sysdba', password='masterkey')
>>>> SELECT = "select name, year_released from languages order by year_released"
>>>> cur.execute(SELECT)
>>>> cur = con.cursor()
>>>> cur.execute(SELECT)
>>>> for (name, year_released) in cur:
> ... print '%s has been publicly available since %d.' % (name, year_released)
> ...
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> TypeError: 'Cursor' object is not iterable

Yes, firebirdsql's cursor object doesn't support the iterator protocol.
Dunno why not, as it's quite simple to implement, just add these next

def next(self):
row = self.fetchone()
if row:
return row
raise StopIteration
def __iter__(self):
return self

best regards
Pavel Cisar