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:
- RAW - Return <row/> elements with columns as attributes.
- AUTO - Return the data in an XML tree structure.
- EXPLICIT - It is a pretty complex version of AUTO.
The DTD can also be requested using the
FOR XML format, DTD. For example:
<!DOCTYPE root [ <!ELEMENT root (row)*> <!ELEMENT row (#PCDATA)> <!ATTLIST row CustomerID CDATA #IMPLIED OrderID CDATA #IMPLIED OrderDate CDATA #IMPLIED> ]>
Override ENCODED from %CSP.Page parameter PRIVATE = 1;
Override PRIVATE from %CSP.Page
The classmethod OnPostHTTP()
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.
The classmethod OnPreHTTP() as
OnPostHTTP()is called by the CSP dispatcher after the page content has been sent. We use it here to clean up the ResultSet
The classmethod PreProcessSQL(sql As
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.
Process the XML SQL extras from the SQL statement before passing it to CacheSQL. The mode is as follows: classmethod ResolveElementName(expr As
- 0 - Default XML-SQL mode
- 1 - Oracle XML-SQL mode