sqlite3 question

Marc 'BlackJack' Rintsch bj_666 at gmx.net
Thu Apr 12 07:43:49 EDT 2007


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')
> 
> That works. But when I can't restore the row by e.g. an ID that does
> not exist, I cannot see any method in 'r' (which is a SQLite.Cursor)
> that can tell me if I have rows. As explained in the help, r.rowcount
> does not give a valid result because it can't determine how many rows
> are restored in advance.

This should not work because `r` should not be a `Cursor` object.  The
`execute()`-Method returns an integer with the number of "affected rows".

Ciao,
	Marc 'BlackJack' Rintsch



More information about the Python-list mailing list