Top

Name

http — write to HTTP client or a string output stream

Synopsis

http ( in val_expr any ,
  in stream any );
 

Description

http writes val_expr to HTTP client or, if parameter stream is given, to the given string output stream.

val_expr may be any scalar object, i.e. string , date or number and will automatically be cast to varchar before further processing. http will print out the string without escapes. http_value uses HTML escapes and http_url URL escapes.

Parameters

val_expr

A value expression. May be any scalar expression.

stream

Optional parameter. If omitted or is 0 and the function is executed within a VSP context, the val_expr will be written to the HTTP client. If present and non-zero, val_expr will be written to the specified stream. If non-zero, the value must be a valid stream obtained from function string_output

Errors

Table 24.37. Errors signalled by http

SQLState Error Code Error Text Description
22023 HT007 An interactive blob can't be passed as argument to http  
22023 HT008 http requires string, blob, or string session as argument 1  
37000 HT006 http output function outside of http context and no stream specified: %s.  

Examples

Example 24.151. HTTP output

Output of various flavours of http. See string_output and string_output_string for examples how to use http to write to streams other than the HTTP output.

http (' % <b>')     ' <b>
http_value (' % <b>')   % &lt;b&gt;
http_url (' % <b>')  +%25+<b>
http_value (12, 'li')  <li>12</li>