[DB-SIG] return value of .fetchall() with an empty result set
Mon, 22 Apr 2002 06:41:53 -0500
> All of the db modules I use return data==() ( or data== ) when
> fetchall returns no rows.
zxJDBC does now as well ;)
> This is consistent both with Python and SQL because your
> query is valid
> but returns an empty set. I wouldn't expect a cursor method
> to raise an
> exception unless some part of the database operation is incorrect or
> fails and I wouldn't expect a valid call to return None, but
> that would
> be better than raising an exception.
> The DB-API
> (http://www.python.org/topics/database/Databas> eAPI-2.0.html)
> is not entirely clear on this subject, so
> maybe some clarification is
> required. I would suggest that when writing your own database handler
I think it should be spelled out as it is for the other two .fetchXXX()
> that the most important thing is to be consistent in how you
> return the
> empty set from fetchone, fetchmany and fetchall.
It is now. I'm suprised it went this long with no one having said
anything. I'm more suprised that I was so inconsistent.