[python-sybase] Re: This routine cannot be called because another
command structure has results pending
Greg Ward
gward-pysybase at python.net
Thu Jul 6 07:23:20 EST 2006
On 05 July 2006, I said:
> However, I suspect a more appropriate fix would be to factor out a
> _close_fetcher() method of Cursor:
>
> def _close_fetcher(self):
> if self._fetcher:
> self._fetcher._close()
> self._fetcher = None
>
> and replace every occurence of "self._fetcher = None" with
> "self._close_fetcher()".
I have done this and it seems to work. I'm certainly not getting any
more mysterious "this routine cannot be called" errors from my
Python/sybase scripts, which makes me very happy indeed.
I'll attach my patch. Does this look correct? Is it likely to be
included in a future release of python-sybase? Do you think I'll get
burned if I deploy a version of python-sybase with this patch applied?
Greg
-------------- next part --------------
--- Sybase.py.orig 2005-04-06 18:46:43.000000000 -0400
+++ Sybase.py 2006-07-05 12:49:12.000000000 -0400
@@ -683,6 +683,11 @@
def _unlock(self):
self._owner._unlock()
+ def _close_fetcher(self):
+ if self._fetcher:
+ self._fetcher._close()
+ self._fetcher = None
+
def callproc(self, name, params = ()):
'''DB-API Cursor.callproc()
'''
@@ -692,7 +697,7 @@
self._lock()
try:
# Discard any previous results
- self._fetcher = None
+ self._close_fetcher()
self.return_status = None
# Prepare to retrieve new results.
@@ -737,7 +742,7 @@
'''
if self._closed:
raise ProgrammingError('cursor is closed')
- self._fetcher = None
+ self._close_fetcher()
self._closed = 1
def execute(self, sql, params = {}):
@@ -749,7 +754,7 @@
self._lock()
try:
# Discard any previous results
- self._fetcher = None
+ self._close_fetcher()
# Prepare to retrieve new results.
fetcher = self._fetcher = _FetchLazy(self._owner)
More information about the Python-sybase
mailing list