HTTP_VARIABLE function [HTTP]

Gets the value of an HTTP variable.

Syntax
HTTP_VARIABLE( var-name [ [ , instance ] , http-header-field ] )
Parameters
  • var-name   The name of an HTTP variable.

  • instance   If more than one variable has the same name, the instance number of the field instance, or NULL to get the first one. Useful for select lists that permit multiple selections.

  • http-header-field   In a multi-part request, a header field name associated with the named field as specified in var-name.

Remarks

This function returns the value of the named HTTP variable. It is used when processing an HTTP request within a web service.

If a header for the given var-name does not exist, the return value is NULL.

When the web service request is a POST, and the variable data is posted as multipart/form-data, the HTTP server receives HTTP headers for each individual variable. When the http-header-field parameter is specified, the HTTP_VARIABLE function returns the associated multipart/form-data header value from the POST request for the particular variable.

All input data goes through character set translation between the client (for example, a browser) character set, and the character set of the database. However, if @BINARY is specified for http-header-field, the variable input value is returned without going through character set translation. This may be useful when receiving binary data, such as image data, from a client.

This function returns NULL when not called from a web service.

See also
Standards and compatibility
  • SQL/2003   Vendor extension.

Examples

The following statements request the Content-Disposition and Content-Type headers of the image variable:

SET v_name = HTTP_VARIABLE( 'image', NULL, 'Content-Disposition' );
SET v_type = HTTP_VARIABLE( 'image', NULL, 'Content-Type' );

The following statement requests the value of the image variable in its current character set, that is, without going through character set translation:

SET v_image = HTTP_VARIABLE( 'image', NULL, '@BINARY' );