[python-sybase] multiple active cursors?

skip@pobox.com skip at pobox.com
Tue, 1 Jun 2004 09:37:00 -0500 (CDT)


I'm not able to use multiple open cursors.  For example, if I execute
a SQL statement on one cursor and then try to execute another SQL
statement on a second cursor I get a DatabaseError exception:

    >>> c1 = conn.cursor()
    >>> c1.execute("select 1")
    >>> c2 = conn.cursor()
    >>> c2.execute("select 2")
    Traceback (most recent call last):
      File "<stdin>", line 1, in ?
      File "/opt/python/lib/python2.3/site-packages/Sybase.py", line 688, in execute    self.description = fetcher.start(self.arraysize)
      File "/opt/python/lib/python2.3/site-packages/Sybase.py", line 440, in start
	status = self._cmd.ct_send()
      File "/opt/python/lib/python2.3/site-packages/Sybase.py", line 158, in _clientmsg_cb
	raise DatabaseError(_fmt_client(msg))
    DatabaseError: Layer: 1, Origin: 1
    ct_send(): user api layer: external error: This routine cannot be called because another command structure has results pending.

If I call nextset() to discard results or explicitly close the cursor
I can execute a statement in another cursor.  Most of my past
Python+SQL experience is with MySQLdb which does allow this sort of
thing.  This is probably a lack of understanding on my part.  Am I not
able to have multiple active cursors?

Thx,

-- 
Skip Montanaro
skip@pobox.com