Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SAP Sybase SQL Anywhere 16.0 » SQL Anywhere Server - Programming » HTTP web services » Access to web services using web clients » Web client application development


Substitution parameters used for clause values

Declared parameters to a stored procedure or function are automatically substituted for placeholders within a clause definition each time the stored procedure or function is run. Substitution parameters allow the creation of general web service procedures that dynamically configure clauses at run time. Any substrings that contain an exclamation mark '!' followed by the name of one of the declared parameters is replaced by that parameter's value. In this way one or more parameter values may be substituted to derive one or more clause values at runtime.

Parameter substitution requires adherence to the following rules:

  • All parameters used for substitution must be alphanumeric. Underscores are not allowed.

  • A substitution parameter must be followed immediately by a non-alphanumeric character or termination. For example, !sizeXL is not substituted with the value of a parameter named size because X is alphanumeric.

  • A substitution parameter that is not matched to a parameter name is ignored.

  • An exclamation mark (!) can be escaped with another exclamation mark.

For example, the following procedure illustrates the use of parameter substitution. URL and HTTP header definitions must be passed as parameters.

CREATE PROCEDURE test(uid CHAR(128), pwd CHAR(128), headers LONG VARCHAR)
    URL 'http://!uid:!pwd@localhost/myservice'
    HEADER '!headers';

You can then use the following statement to call the test procedure and initiate an HTTP request:

CALL test('dba', 'sql', 'NewHeader1:value1\nNewHeader2:value2');

Different values can be used each time this procedure is called.

 Encryption certificate example
 No matching parameter name example