[python-sybase] Sybase Module 0.36 Output Parameter Handling

Skip Montanaro skip at pobox.com
Wed, 16 Mar 2005 18:30:08 -0600


    Bradley> For example:

    Bradley> C.callproc ('testproc', {'@parm1': 'value1', '@outputparm':
    Bradley> Sybase.OUTPUT(1)})

    Bradley> If I print the callproc object after it executes I get back
    Bradley> something like: {'@parm1':'value1','@outputparm': <DataBufType
    Bradley> object at 0x2a394999>}

    Bradley> So how to I examine the contents of the DataBufType object,
    Bradley> using python db api syntax?

I think it's returned by a subsequent call to C.fetchall().  A stored
procedure can return the result of multiple selects so you need to keep
asking the cursor if there are more result sets and call fetchall() as long
as there are:

        while True:
           rows = C.fetchall()
           print rows
           if not C.nextset():
               break

    Bradley> Finally, what does the "1" in Sybase.OUTPUT(1) mean?  

I don't recall.  Someone else will have to chime in.

Skip