[DB-SIG] 'long' object has no attribute 'fetchall'

Magnus Lycka magnus@thinkware.se
Sun, 03 Nov 2002 23:33:30 +0100


At 23:01 2002-11-03 +0100, you wrote:
>cursor = db.cursor()
>cursor = cursor.execute('SELECT * FROM articles')

You loose your cursor here, as you reassign the variable
called cursor to the return value from the execute call.
The result of cursor.execute() is the number of affected
rows if my memory serves me right.

Just change that line of code to

cursor.execute('SELECT * FROM articles')

and you will be fine. If you wish, you can take care
of the return value, but be certain to use another
variable for that.

rowCount = cursor.execute('SELECT * FROM articles')
print rowCount, "row(s) found"

>cursor.fetchall()
>
>Error is:
>AttributeError: 'long' object has no attribute 'fetchall'

>Thaks,

What's a Thak? ;)


-- 
Magnus Lycka, Thinkware AB
Alvans vag 99, SE-907 50 UMEA, SWEDEN
phone: int+46 70 582 80 65, fax: int+46 70 612 80 65
http://www.thinkware.se/  mailto:magnus@thinkware.se