Problem with sqlite

Carsten Haese carsten.haese at gmail.com
Sat Mar 29 21:45:37 EDT 2008


On Mar 29, 9:10 pm, Tim Roberts <t... at probo.com> wrote:
> aiwarrior <zube... at yahoo.com.br> wrote:
> >    def get_value( self, column ):
> >        self.cursor.execute( "SELECT %s FROM database" % column )
> >        for n in self.cursor:
> >             print n
>
> I suspect you wanted "self.cursor.fetchall()" there, but since you don't
> call it, it doesn't matter yet.

sqlite3's cursor objects support the iteration protocol, so the for-
loop does work without calling fetchall().

--
Carsten Haese
http://informixdb.sourceforge.net



More information about the Python-list mailing list