[Zope-dev] Stored Procedures with Sybase and the Sybase DA

Phillip J. Eby pje@telecommunity.com
Mon, 01 Oct 2001 07:25:10 -0500


At 01:50 PM 10/1/01 +0200, Thomas_Janke@prisma-edv.de wrote:

>Does anybody know of any development going on regarding Sybase and stored
>procedures? Christopher Petrilli declared them a future goal, but I urgently
>need them by now. So if anybody has a workarround, please let me know.

Ty did some work on this for Zope 2.2 which you can find at:

http://cvs.eby-sarna.com/ZProducts/SybaseStoredProcedure/


There's no docs to speak of.  Feel free to use it if you can get it to 
work.  I think that to get this to work, we also had to patch the Sybase DA 
to handle status result codes, but that patch might have been incorporated 
into Zope.  I'm not positive about any of this.  :(  All I can tell you is 
that the code above is in actual use in a production application that 
needed stored-procedure support.

Note that it does not support returning SELECT results from procedures; 
only non-negative status returns.  It assumes a negative status is an 
error, and if it's one of the standard Sybase status error codes (e.g. -3 
for a deadlock), it throws a "SybaseProcError" with an explanation and the 
original query text.

The return value from calling a StoredProcedure object is always an integer 
0 or greater, unless the status return is negative, in which case an 
exception is raised.