Programming Considerations

This section describes some programming considerations that you will need to keep in mind when writing an Open Data Services server application that uses the PROCSRV sample application as a model.

With standard stored procedures, an administrator can define a set of user-specified parameters that will be validated by SQL Server. When creating procedures using the Open Data Services API, the application must validate any user-specified parameters.

Each function in your application should follow these recommendations for accepting and responding to user input:

  1. Check that the caller of the procedure has provided in all the required parameters and that each parameter is of the appropriate datatype. Return an appropriate message if not.
  2. Define the columns for returning a results set.
  3. Create each record for returning to the caller.
  4. Set up any output parameters and return statuses used by the procedure.
  5. When finished returning results, send the results completion message using srv_senddone with the SRV_DONE_FINAL status flag.