Class Reference
Cache for UNIX 2018.1.3
InterSystems: The power behind what matters   
Documentation  Search
Private  Storage  

class %CSP.XMLSQL extends %CSP.Page

The %CSP.XMLSQL accepts an SQL statement in the incoming URL and executes it as a Dynamic SQL query. The results are returned in an XML format that corresponds to the MS XML-SQL Server format. See:

There are 3 formats that can be specified using the FOR XML command:

The DTD can also be requested using the FOR XML format, DTD. For example:
<!DOCTYPE root [
<!ELEMENT root (row)*>


Parameters Properties Methods Queries Indices ForeignKeys Triggers
2 9


%ClassIsLatestVersion %ClassName %DispatchClassMethod %DispatchGetModified
%DispatchGetProperty %DispatchMethod %DispatchSetModified %DispatchSetMultidimProperty
%DispatchSetProperty %Extends %GetParameter %IsA
%New %OriginalNamespace %PackageName %SetModified
ConvertParameter Decrypt Encrypt EscapeHTML
EscapeURL HyperEventCall HyperEventHead Include
InsertHiddenField InsertHiddenFields IsPrivate Link
OnHTTPHeader OnPage OnPageError OnPostHTTP
OnPostHyperEvent OnPreHTTP OnPreHyperEvent Page
PreProcessSQL QuoteJS ResolveElementName RewriteURL
ShowError StartTimer StopTimer ThrowError
UnescapeHTML UnescapeURL


• parameter ENCODED = 2;
Override ENCODED from %CSP.Page
• parameter PRIVATE = 1;
Override PRIVATE from %CSP.Page


• classmethod OnPage() as %Status
The OnPage() is called by the CSP dispatcher to generate the page content. For XMLSQL, we loop across the ResultSet and output the contents as XML.
• classmethod OnPostHTTP()
The OnPostHTTP() is called by the CSP dispatcher after the page content has been sent. We use it here to clean up the ResultSet
• classmethod OnPreHTTP() as %Boolean
The OnPreHTTP() is called by the CSP dispatcher before the HTTP headers have been sent. Here, we prepare the Dynamic SQL query and set the content type to text/xml.
• classmethod PreProcessSQL(sql As %String, ByRef args As %String, mode As %Integer, ByRef xmlmode As %String) as %String
Process the XML SQL extras from the SQL statement before passing it to CacheSQL. The mode is as follows:

  • 0 - Default XML-SQL mode
  • 1 - Oracle XML-SQL mode

• classmethod ResolveElementName(expr As %String, element, AssumeName) as %String

Copyright © 1997-2020, InterSystems Corporation