[python-sybase] getting past server messages

Chris Curvey chris at chriscurvey.com
Fri, 18 Apr 2003 07:19:46 -0700 (PDT)


Hi all,

I'm playing with the Sybase-Python interface (0.35), and I can't seem
to figure out how to get past a statement that gives an informational
error.  Here's my code fragment:

    sql = "exec sp_foreignkey 'ccc_test', 'sysobjects', 'b'"
    query = conn.cursor()
    try:
        query.callproc("sp_foreignkey" , ["ccc_test", "sysobjects",
"b"])
    except Sybase.DatabaseError, e:
        print e

    conn.execute("select * from sysobjects")


and here is what I get



Level 10, State 1, Procedure sp_foreignkey, Line 559
New foreign key added.
Traceback (most recent call last):
  File "Table.py", line 233, in ?
    conn.execute("select * from sysobjects")
  File "/usr/local/lib/python2.2/site-packages/Sybase.py", line 724, in
execute
    status = cmd.ct_send()
  File "/usr/local/lib/python2.2/site-packages/Sybase.py", line 141, in
_clientmsg_cb
    raise DatabaseError(_fmt_client(msg))
Sybase.DatabaseError: Layer: 1, Origin: 1
ct_send(): user api layer: external error: This routine cannot be
called because another command structure has results pending.


So, how can I clear the connection (preferably by using a callback
handler)?  I tried adding rows = query.fetchall(), but that fails with
a different error.



=====
Chris Curvey
Curvey Consulting
http://www.chriscurvey.com

__________________________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo
http://search.yahoo.com