|   | ![[ Previous ]](navbprev.gif)  ![[ Contents ]](navbhome.gif)  ![[ Index ]](navbhelp.gif)  ![[ Next ]](navbnext.gif)  | 
Begin stored procedure definition
void Ns_PdDbSpStart(void *handle, char *procname)
This function begins the definition of a stored procedure.
    void    
    Ns_PdDbSpStart(void *handle, char *procname)
    {
        DBMSStart   *state = (DBMSState *) handle;
        DBMSRetcode  code;
    
        /*
         * Create a new stored procedure command if it hasn't been 
allocated yet
         */
    
        if (state->cmd == NULL) {
            code = DBMSCmdAlloc(state, &state->cmd);
            if (code == DBMS_ERROR) {
                Ns_PdLog(Error, "DbSpStart: DBMSCmdAlloc() failed.");
                Ns_PdSendException(state->exceptionCode, state->exceptionMsg);
            }
        }
    
        /*
         * Clear out any existing command structure
         */
    
        code = DBMSCancel(state);
        if (code != DBMS_OK) {
            Ns_PdLog(Error, "DbSpStart: DBMSCancel() failed.");
            Ns_PdSendException(state->exceptionCode, state->exceptionMsg);
            return;
        }
    
        /*
         * Set up a new command structure for this stored procedure
         */
    
        code = DBMSCommand(state->cmd, procname);
        if (tcode != DBMS_OK) {
            Ns_PdLog(Error, "DbSpStart: DBMSCommand() failed.");
            Ns_PdSendException(state->exceptionCode, state->exceptionMsg);
            return;
        }
    
        Ns_PdSendString(OK_STATUS);
    }