sqlite3 question

Marc 'BlackJack' Rintsch bj_666 at gmx.net
Mon Apr 16 08:47:12 CEST 2007


In <op.tqopkog2x6zn5v at furufufa-ec0e13.cpe.telecentro.com.ar>, Gabriel
Genellina wrote:

> En Thu, 12 Apr 2007 08:43:49 -0300, Marc 'BlackJack' Rintsch  
> <bj_666 at gmx.net> escribió:
> 
>> In <mailman.6384.1176363488.32031.python-list at python.org>, Jorgen Bodde
>> wrote:
>>
>>>>>> r = c.execute('select * from song where id = 1')
>>>>>> for s in r:
>>> ... 	print s
>>> ... 	
>>> (1, u'Spikedrivers Blues', u'Mississippi John Hurt')
> 
>> This should not work because `r` should not be a `Cursor` object.  The
>> `execute()`-Method returns an integer with the number of "affected rows".
> 
> Actually DBAPI 2.0 says the return value is undefined.

I just remembered the number of affected rows, but that's just for data
manipulation statements like ``UPDATE`` or ``INSERT``.  For ``SELECT`` the
method should return `None`.  My bad.

Ciao,
	Marc 'BlackJack' Rintsch



More information about the Python-list mailing list