[python-sybase] ProgramingError on empty result set

Hrvoje Niksic hniksic at iskon.hr
Wed, 13 Aug 2003 12:40:42 +0200


I'm using python-sybase with MS SQL 6.5 and FreeTDS 0.61.  I keep
stumbling upon this:

>>> import Sybase
>>> conn=Sybase.connect(...)
>>> c=conn.cursor()
>>> c.execute("select * from customer where name='nosuchname'")
>>> c.fetchall()
Traceback (most recent call last):
   File "<stdin>", line 1, in ?
   File "/usr/local/lib/python2.2/site-packages/Sybase.py", line 733, in
fetchall
     return self._fetcher.fetchall()
   File "/usr/local/lib/python2.2/site-packages/Sybase.py", line 517, in
fetchall
     row = self.fetchone()
   File "/usr/local/lib/python2.2/site-packages/Sybase.py", line 448, in
fetchone
     self._raise_error(ProgrammingError, 'no result set pending')
   File "/usr/local/lib/python2.2/site-packages/Sybase.py", line 432, in
_raise_error
     raise exc(text)
Sybase.ProgrammingError: no result set pending
>>>

Shouldn't fetchall() simply return an empty list when no results are
available?