Renaming ESPs  System ESPs

Chapter 17: Using Extended Stored Procedures

Executing ESPs

Execute an ESP using the same execute command that you use to execute a regular stored procedure. See “Creating and executing stored procedures” for syntax and other information about executing stored procedures.

You can also execute an ESP remotely. See “Executing procedures remotely” for information about executing remote stored procedures.

Because the execution of any ESP involves a remote procedure call between Adaptive Server and XP Server, you cannot combine parameters by name and parameters by value in the same execute command. All the parameters must be passed by name, or all must be passed by value. This is the only way in which the execution of extended stored procedures differs from that of regular stored procedures.

ESPs can return:

An ESP function reports the return status value with the srv_sendstatus Open Server routines. The return status values from srv_sendstatus are application-specific. However, a status of zero indicates that the request completed normally.

When there is no parameter declaration list for an extended stored procedure, Adaptive Server ignores all supplied parameters but issues no error message. If you supply more parameters when you execute the ESP than you declare in the declaration list, Adaptive Server calls them anyway. To avoid confusion about what parameters are called, check that the parameters on the declaration list match the parameters supplied at run time. You should also check the number of parameters in the specified ESP at the Open Server function build.

An ESP function returns the values of output parameters and result sets using the srv_descfmt, srv_bind, and srv_xferdata Open Server routine. See the “ESP function example” and the Open Server Server-Library/C Reference Manual for more information about passing values from an ESP function. From the Adaptive Server side, returned values from an ESP are handled as they are for a regular stored procedure.





Copyright © 2005. Sybase Inc. All rights reserved. System ESPs

View this book as PDF