From: <sa...@us...> - 2007-12-10 18:31:55
|
Hi Oliver, 4040 is the code for CS_ROW_RESULT. I am not sure why it happens at that time. The coming version of python-sybase in svn should be able to handle this more gracefully but it is not completely ready yet. I hope to be able to release it before the end of the month or early next year. If the problem persists when this new version is released, then please send me an email so that we can write a small test case. regards -- Sébastien Sablé Bock, Oliver BGI SYD a écrit : > I am connecting to Sybase IQ/12.6.0 using python-sybase and Adaptive > Server IQ Network Client 12.6 on Windows XP. Everything works fine for > small queries, but a very large query (73000 rows returned) fails like > this: > > Traceback (most recent call last): > File "C:\workspace\AlphaExplorer\sql.py", line 19, in ? > row = curs.fetchone() > File "C:\Python24\Lib\site-packages\Sybase.py", line 817, in fetchone > return self._fetcher.fetchone() > File "C:\Python24\Lib\site-packages\Sybase.py", line 555, in fetchone > self._fetch_rowcount() > File "C:\Python24\Lib\site-packages\Sybase.py", line 682, in > _fetch_rowcount > self._raise_error(Error, 'ct_results returned result %s' % > str(result)) > File "C:\Python24\Lib\site-packages\Sybase.py", line 519, in > _raise_error > raise exc(text) > Sybase.Error: ct_results returned result 4040 > > This error occurs after I have fetched the last row. (That is, I expect > it to return None, indicating that there is nothing left.) > > Note that I have modified _fetch_rowcount to give information on the > result code returned, and it is 4040, which may correspond to > CS_ROW_RESULT, although I cannot work out why this should be returned at > this time. > > I can work around the problem by catching the "ct_results" exception and > ignoring it, but obviously I would prefer to get to the root cause of > the problem. > > > Oliver > > > P.S. python-sybase is MUCH faster than ODBC for this large query: ODBC > takes 25 minutes and python-sybase takes 18 seconds! (The server is in > another country so I guess there is a very high network latency.) > |