Hey there,
i have a simple database query that returns as a tuple the number of
rows that the query selected.
kinda like this
[color=blue][color=green][color=darkred]
>>> cursor.execute( 'select value from table where autoinc > 234')
>>> x = cursor.fetchall ()
>>> print x[/color][/color][/color]
[color=blue][color=green][color=darkred]
>>> 21L[/color][/color][/color]
ok, means 21 rows met the criteria of the query. but if there are none
that match,
like i do a
[color=blue][color=green][color=darkred]
>>> print x
>>> 0L[/color][/color][/color]
how do i encorporate that into an equation ?
i have tried all kinds of stuff
if x == 0L
if x(0) == None
if x == None
anyway, what shoud i do to test if the result is empty?
thanks
i have a simple database query that returns as a tuple the number of
rows that the query selected.
kinda like this
[color=blue][color=green][color=darkred]
>>> cursor.execute( 'select value from table where autoinc > 234')
>>> x = cursor.fetchall ()
>>> print x[/color][/color][/color]
[color=blue][color=green][color=darkred]
>>> 21L[/color][/color][/color]
ok, means 21 rows met the criteria of the query. but if there are none
that match,
like i do a
[color=blue][color=green][color=darkred]
>>> print x
>>> 0L[/color][/color][/color]
how do i encorporate that into an equation ?
i have tried all kinds of stuff
if x == 0L
if x(0) == None
if x == None
anyway, what shoud i do to test if the result is empty?
thanks
Comment