Sophie

Sophie

distrib > Fedora > 14 > x86_64 > media > updates > by-pkgid > 71d40963b505df4524269198e237b3e3 > files > 1095

virtuoso-opensource-doc-6.1.4-2.fc14.noarch.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
 <head profile="http://internetalchemy.org/2003/02/profile">
  <link rel="foaf" type="application/rdf+xml" title="FOAF" href="http://www.openlinksw.com/dataspace/uda/about.rdf" />
  <link rel="schema.dc" href="http://purl.org/dc/elements/1.1/" />
  <meta name="dc.title" content="15. Web Services" />
  <meta name="dc.subject" content="15. Web Services" />
  <meta name="dc.creator" content="OpenLink Software Documentation Team ;&#10;" />
  <meta name="dc.copyright" content="OpenLink Software, 1999 - 2009" />
  <link rel="top" href="index.html" title="OpenLink Virtuoso Universal Server: Documentation" />
  <link rel="search" href="/doc/adv_search.vspx" title="Search OpenLink Virtuoso Universal Server: Documentation" />
  <link rel="parent" href="webservices.html" title="Chapter Contents" />
  <link rel="prev" href="bpel.html" title="BPEL Reference" />
  <link rel="next" href="contents.html" title="Contents" />
  <link rel="shortcut icon" href="../images/misc/favicon.ico" type="image/x-icon" />
  <link rel="stylesheet" type="text/css" href="doc.css" />
  <link rel="stylesheet" type="text/css" href="/doc/translation.css" />
  <title>15. Web Services</title>
  <meta http-equiv="Content-Type" content="text/xhtml; charset=UTF-8" />
  <meta name="author" content="OpenLink Software Documentation Team ;&#10;" />
  <meta name="copyright" content="OpenLink Software, 1999 - 2009" />
  <meta name="keywords" content="" />
  <meta name="GENERATOR" content="OpenLink XSLT Team" />
 </head>
 <body>
  <div id="header">
    <a name="xsql" />
    <img src="../images/misc/logo.jpg" alt="" />
    <h1>15. Web Services</h1>
  </div>
  <div id="navbartop">
   <div>
      <a class="link" href="webservices.html">Chapter Contents</a> | <a class="link" href="bpel.html" title="BPEL Reference">Prev</a> | <a class="link" href="runtimehosting.html" title="Runtime Hosting">Next</a>
   </div>
  </div>
  <div id="currenttoc">
   <form method="post" action="/doc/adv_search.vspx">
    <div class="search">Keyword Search: <br />
        <input type="text" name="q" /> <input type="submit" name="go" value="Go" />
    </div>
   </form>
   <div>
      <a href="http://www.openlinksw.com/">www.openlinksw.com</a>
   </div>
   <div>
      <a href="http://docs.openlinksw.com/">docs.openlinksw.com</a>
   </div>
    <br />
   <div>
      <a href="index.html">Book Home</a>
   </div>
    <br />
   <div>
      <a href="contents.html">Contents</a>
   </div>
   <div>
      <a href="preface.html">Preface</a>
   </div>
    <br />
   <div class="selected">
      <a href="webservices.html">Web Services</a>
   </div>
    <br />
   <div>
      <a href="soap.html">SOAP</a>
   </div>
   <div>
      <a href="wsdl.html">WSDL</a>
   </div>
   <div>
      <a href="vfoafssl.html">WebID Protocol Support</a>
   </div>
   <div>
      <a href="voauth.html">OAuth Support</a>
   </div>
   <div>
      <a href="vwsssupport.html">WS-Security (WSS) Support in Virtuoso SOAP Server</a>
   </div>
   <div>
      <a href="ws-routing.html">Web Services Routing Protocol (WS-Routing)</a>
   </div>
   <div>
      <a href="warm.html">Web Services Reliable Messaging Protocol (WS-ReliableMessaging)</a>
   </div>
   <div>
      <a href="vwstrust.html">Web Services Trust Protocol (WS-Trust)</a>
   </div>
   <div>
      <a href="xmlxmla.html">XML for Analysis Provider</a>
   </div>
   <div>
      <a href="xmlrpc.html">XML-RPC support</a>
   </div>
   <div>
      <a href="syncml.html">SyncML</a>
   </div>
   <div>
      <a href="uddi.html">UDDI</a>
   </div>
   <div>
      <a href="expwsmodules.html">Exposing Persistent Stored Modules as Web Services</a>
   </div>
   <div>
      <a href="vsmx.html">Testing Web Published Web Services</a>
   </div>
   <div>
      <a href="bpel.html">BPEL Reference</a>
   </div>
   <div class="selected">
      <a href="xsql.html">XSQL</a>
    <div>
        <a href="#xsqlsyntax" title="XSQL Syntax">XSQL Syntax</a>
        <a href="#xsqldirectives" title="XSQL Directives">XSQL Directives</a>
    </div>
   </div>
    <br />
  </div>
  <div id="text">
    <a name="xsql" />
    <h2>15.16. XSQL</h2>

<p>XSQL is an XML-based format for describing simple stored procedures that
can parse XML data, query or update database tables and compose XML output.
Both input and output XMLs of such procedures are usually standard three-level
documents: a top-level <span class="computeroutput">ROWSET</span> element contains
some number of <span class="computeroutput">ROW</span> elements and every
<span class="computeroutput">ROW</span> contains one element per database field.
XSQL lets the application developer avoid writing routine code for parsing
and composing such documents:
the server translates a short and self-evident XSQL description into a relatively long Virtuoso/PL procedure.</p>

<p>
XSQL pages are usually executed from XSLT stylesheets by calling
<a href="xpf_processXSQL.html">processXSQL()</a> XPATH function.
When the page is executed, it can access an XML entity that is context entity of the
<span class="computeroutput">processXSQL()</span> call. This entity is used inside the page as an
implicit parameter called &quot;context XML&quot;.</p>

<p>An XSQL document that describes one procedure is called &quot;XSQL page&quot;.
A page consists of small directives.
Every directive is written as a single XML element from namespace &quot;urn:oracle-xsql&quot; (the typical namespace prefix is &quot;xsql&quot;).
Every directive describes one standard operation.
The resulting Virtuoso/PL procedure will execute all directives in turn.
Directives are of four sorts:</p>

<ul>
      <li>Parameter assignments create and initialize local variables (&quot;page parameters&quot;) that can be used in the rest of page.</li>
      <li>Data modification requests can insert, delete or update data in database tables.</li>
      <li>XML generators can query database or page parameters and produce XML fragments. These fragments form
the resulting XML that is returned by the procedure.</li>
      <li>DML directives let the author to put arbitrary Virtuoso/PL code in the procedure.</li>
    </ul>
<p>
All directives are children of one op-level element called &#39;xsql:page&#39;.
This element can have any number of attributes but no one attribute is used by Virtuoso.
These attributes may be used by specialized XSQL editors and standalone XSQL processors that should
establish a database connection to read and write data so store connection details as
attributes of &#39;xsql:page&#39;.
</p>

<p>The XSQL development cycle consists of editing &#39;.xsql&#39; resources in the
file system or Virtuoso DAV.  The editing can take place using a
regular text editor or a supporting XML editor or some specialized third-party XSQL tool.</p>

 <a name="xsqlsyntax" />
    <h3>15.16.1. XSQL Syntax</h3>
   <p>Properties of each XSQL directives are specified by XML attributes.
These attributes are of different types, mostly SQL expressions, calculateable strings,
SQL names and lists of names (e.g., name of a database table or a list of columns of a table).
   </p>
   <p>
In some cases, SQL expressions are long and it is not convenient to place them into attribute values.
Such expressions are written as text content of the XSQL directive element.
   </p>
   <div class="formalpara">
      <strong>SQL expressions</strong>
   <p>XSQL allows slightly extended syntax of SQL expressions. If X is a name of page parameter made by xsql:set-page-param then
special notation &quot;{@X}&quot; stands for the reference to the parameter value.
This notation can be used in any place where a variable name is acceptable.
In addition, this notation can be used inside string literals, such a literal is translated into
a string concatenation expression; e.g., <span class="computeroutput">&#39;text-head{@X}text-middle{@Y}text-tail&#39;</span> is converted into
<span class="computeroutput">concat (&#39;text-head&#39;, cast ({@X} as varchar), &#39;text-middle&#39;, cast ({@Y} as varchar), &#39;text-tail&#39;)</span>.
   </p>
    </div>
   <div class="formalpara">
      <strong>Calculateable strings</strong>
   <p>Some attribute values are strings like resource URIs or XML names to be used in the output generated by a page.
They are usually written &#39;as is&#39; but they can use &quot;{@X}&quot; notation to insert the value of page parameter into the
resulting string. The actual value of a calculateable string is compiled only once even if it appears many times in the
XML output of the page.
   </p>
    </div>
   <div class="formalpara">
      <strong>Names of SQL columns</strong>
   <p>Some attributes are not arbitrary SQL expressions but only SQL column names. These names are written &#39;as is&#39;.
Only unqualified names are allowed, not in form &#39;table.column&#39;.
No &quot;{@X}&quot; is allowed for obvious reasons.
If SQL name is case-sensitive or contains nonalphabetical characters
then the name should be enclosed in double quotes.
For readability, use single quotes to surround attribute value to not mix them with possible double quotes used in SQL name.
Whitespace characters are not allowed in these names because these will not make proper names of XML elements.
</p>
    </div>
   <div class="formalpara">
      <strong>Names of SQL tables</strong>
   <p>SQL table names are also written &#39;as is&#39;, with the same rules for double quotes around case-sensitive parts of the name.
Both qualified and unqualified names are allowed. </p>
    </div>
   <div class="formalpara">
      <strong>Lists of names of SQL columns</strong>
   <p>When the value of attribute lists one or more column names,
white space characters or commas delimit column names.
The list should be space-delimited like &#39;COL1 COL2 COL3&#39; or comma-delimited like &#39;COL1, COL2, COL3&#39;
but not a mix of them like &#39;COL1, COL2 COL3&#39;.</p>
    </div>
 <br />
 <a name="xsqldirectives" />
    <h3>15.16.2. XSQL Directives</h3>

   <a name="xsql_delete_request" />
    <h4>15.16.2.1. xsql:delete-request</h4>
    <p>Deletes the rows listed in the context XML.</p>
    <div>
      <pre class="programlisting">
&lt;xsql:delete-request
  table=&quot;table_name&quot;
  key-columns=&quot;column_list&quot;
  [ transform=&quot;calculateable_URI_string&quot; ]
/&gt;
</pre>
    </div>
    <p>If &#39;transform&#39; URI is specified then it is used as a name of XSLT stylesheet that is applied to the
context XML before the rest of processing. The result of that stylesheet should be in standard ROWSET/ROW form.
The result may also contain elements with other names but they will be silently ignored.
</p>
    <p>After this optional XSLT transformation, the XSQL procedure gets all ROW elements in all top-level ROWSET
elements of the source XML. For each such element it parses all subelements whose names match column names listed in
the &#39;key-columns&#39; attribute.
It is legal to have a ROW element that does not contain an element that matches a particular column; the missing element is
treated as a database NULL. If a subelement of ROW has attribute &#39;NULL&#39; equal to &#39;Y&#39; then it is also treated as
database NULL.</p>
    <p>When required subelements of ROW are parsed, the procedure deletes all rows from the specified table that have all specified column values equal to values specified
by ROW subelements. When the delete operation is complete, the procedure parses all subelements of the next ROW element in
queue and so on.</p>
    <div>
      <pre class="programlisting">
&lt;xsql:delete-request table=&#39;&quot;Demo&quot;.&quot;demo&quot;.&quot;Customers&quot;&#39; key-columns=&#39;&quot;CustomerID&quot;&#39;/&gt;
</pre>
    </div>
    <br />

   <a name="xsql_dml" />
    <h4>15.16.2.2. xsql:dml</h4>
    <p>Executes an arbitrary fragment of Virtuoso/PL code.</p>
    <div>
      <pre class="programlisting">
&lt;xsql:dml&gt;
One or more Virtuoso/PL statements, {@X} syntax is allowed.
&lt;/xsql:dml&gt;
</pre>
    </div>
    <p>The XSQL procedure will contain the text of the directive &#39;as is&#39;; the only change is that
<span class="computeroutput">{@X}</span> notation is replaced with appropriate Virtuoso/PL variables.
Note that the use of <span class="computeroutput">&lt;![CDATA[...]]&gt;</span> XML syntax is very convenient here.
</p>
    <div>
      <pre class="programlisting">
&lt;xsql:set-page-param name=&quot;X&quot; value=&quot;2&quot;/&gt;
&lt;xsql:set-page-param name=&quot;Y&quot; value=&quot;2&quot;/&gt;
&lt;xsql:dml&gt;&lt;![CDATA[
-- This will simply print the string on server&#39;s console:
dbg_obj_print (&#39;Hello World\n&#39;);
-- This will compose a string &#39;2 * 2 =&#39; and print on console:
dbg_obj_print (&#39;{@X} * {@Y} = &#39;);
-- This will calculate and print a well-known product.
-- Note that attempt to write {@X * @Y} or {@X * Y} results in a syntax error.
dbg_obj_print ({@X} * {@Y}, &#39;\n&#39;);
]]&gt;
&lt;/xsql:dml&gt;
</pre>
    </div>
    <br />

   <a name="xsql_include_owa" />
    <h4>15.16.2.3. xsql:include-owa</h4>
    <p>This Oracle-specific directive is not implemented.</p>
    <br />


   <a name="xsql_include_param" />
    <h4>15.16.2.4. xsql:include-param</h4>
    <p>Puts the value of the specified page parameter into the resulting XML of the page.</p>
    <div>
      <pre class="programlisting">
&lt;xsql:include-param name=&quot;page_param_name&quot;/&gt;
</pre>
    </div>
    <p>This writes the value of the specified page parameter as an element whose name is made from
the name of parameter. NULL value results in an empty element that has attribute named &#39;NULL&#39; with value &#39;Y&#39;.</p>
    <p>Note that XML elements ROWSET and ROW have special use in XSQL pages. The use of parameter names
ROWSET and ROW is legal but may cause undesired effects.</p>
    <div>
      <pre class="programlisting">
&lt;xsql:set-page-param name=&quot;an-int&quot; value=&quot;2&quot;/&gt;
&lt;xsql:set-page-param name=&quot;an-xml&quot; value=&quot;xtree_doc(&#39;&lt;sample&gt;text&lt;/sample&gt;&#39;)&quot;/&gt;
&lt;xsql:set-page-param name=&quot;a-null&quot; value=&quot;NULL&quot;/&gt;
&lt;!-- This will form an element &lt;an-int&gt;2&lt;/an-int&gt; --&gt;
&lt;xsql:include-param name=&quot;an-int&quot;/&gt;
&lt;!-- This will form an element &lt;an-xml&gt;&lt;sample&gt;text&lt;/sample&gt;&lt;/an-xml&gt; --&gt;
&lt;xsql:include-param name=&quot;an-xml&quot;/&gt;
&lt;!-- This will form an element &lt;a-null NULL=&quot;Y&quot;/&gt; --&gt;
&lt;xsql:include-param name=&quot;a-null&quot;/&gt;
</pre>
    </div>
    <br />

   <a name="xsql_include_request_params" />
    <h4>15.16.2.5. xsql:include-request-params</h4>
    <p>This directive is not implemented in this version.</p>
    <br />

   <a name="xsql_include_xml" />
    <h4>15.16.2.6. xsql:include-xml</h4>
    <p>This directive is not implemented in this version.</p>
    <br />

   <a name="xsql_include_xsql" />
    <h4>15.16.2.7. xsql:include-xsql</h4>
    <p>This directive is not implemented in this version.</p>
    <br />

   <a name="xsql_insert_param" />
    <h4>15.16.2.8. xsql:insert-param</h4>
    <p>Inserts rows listed in XML that is stored in page parameter.</p>
    <div>
      <pre class="programlisting">
&lt;xsql:insert-param
  name=&quot;parameter_XML_name&quot;
  table=&quot;table_name&quot;
  [ mode=&quot;enum&quot; (could be &quot;into&quot;, &quot;soft&quot; or &quot;replacing&quot;, default is &quot;into&quot;) ]
  [ columns=&quot;column_list&quot; ]
  [ date-format=&quot;string&quot; (allowed but ignored) ]
  [ transform=&quot;calculateable_URI_string&quot; ]
/&gt;
</pre>
    </div>
    <p>The directive inserts into a table all data rows listed in the value of a page parameter that is named by &#39;name&#39; attribute.
The destination table is specified by &#39;table&#39; attribute.
</p>
    <p>If &#39;transform&#39; URI is specified then it is used as a name of XSLT stylesheet that is applied to the
source data before the rest of processing. The result of that stylesheet should be in standard ROWSET/ROW form.
The result may also contain redundant elements but they will be silently ignored.
</p>
    <p>After this optional XSLT transformation, the XSQL procedure gets all ROW elements in all top-level ROWSET
elements of the source. For each such element it parses all subelements whose names match column names listed in
the &#39;columns&#39; attribute; if the &#39;columns&#39; attribute is not specified then all column names from
the destination table are used.
It is legal to have a ROW element that does not contain an element that matches a particular column; the missing element is
treated as a database NULL. If a subelement of ROW has attribute &#39;NULL&#39; equal to &#39;Y&#39; then it is also treated as
database NULL.</p>
    <p>When required subelements of ROW are parsed, the procedure adds a row to the table.
It executes INSERT INTO, INSERT SOFT or INSERT REPLACING statement depending on the value of &#39;mode&#39; attribute.
When the insert operation is complete, the procedure parses all subelements of the next ROW element in queue and so on.</p>
    <div>
      <pre class="programlisting">
&lt;xsql:insert-param name=&quot;customer-details&quot; table=&#39;&quot;Demo&quot;.&quot;demo&quot;.&quot;Customers&quot;&#39; /&gt;
</pre>
    </div>
    <br />

   <a name="xsql_insert_request" />
    <h4>15.16.2.9. xsql:insert-request</h4>
    <p>Inserts the rows listed in context XML.</p>
    <div>
      <pre class="programlisting">
&lt;xsql:insert-request
  table=&quot;table_name&quot;
  [ mode=&quot;enum&quot; (could be &quot;into&quot;, &quot;soft&quot; or &quot;replacing&quot;, default is &quot;into&quot;) ]
  [ columns=&quot;column_list&quot; ]
  [ date-format=&quot;string&quot; (allowed but ignored) ]
  [ transform=&quot;calculateable_URI_string&quot; ]
/&gt;
</pre>
    </div>
    <p>The directive inserts into a table all data rows listed in context XML.
The destination table is specified by &#39;table&#39; attribute.
</p>
    <p>If &#39;transform&#39; URI is specified then it is used as a name of XSLT stylesheet that is applied to the
context XML before the rest of processing. The result of that stylesheet should be in standard ROWSET/ROW form.
The result may also contain redundant elements but they will be silently ignored.
</p>
    <p>After this optional XSLT transformation, the XSQL procedure gets all ROW elements in all top-level ROWSET
elements of the source. For each such element it parses all subelements whose names match column names listed in
the &#39;columns&#39; attribute; if the &#39;columns&#39; attribute is not specified then all column names from
the destination table are used.
It is legal to have a ROW element that does not contain an element that matches a particular column; the missing element is
treated as a database NULL. If a subelement of ROW has attribute &#39;NULL&#39; equal to &#39;Y&#39; then it is also treated as
database NULL.</p>
    <p>When required subelements of ROW are parsed, the procedure adds a row to the table.
It executes INSERT INTO, INSERT SOFT or INSERT REPLACING statement depending on the value of &#39;mode&#39; attribute.
When the insert operation is complete, the procedure parses all subelements of the next ROW element in queue and so on.</p>
    <div>
      <pre class="programlisting">
&lt;xsql:insert-request table=&#39;&quot;Demo&quot;.&quot;demo&quot;.&quot;Customers&quot;&#39; columns=&#39;&quot;CustomerID&quot;, &quot;Phone&quot;, &quot;Fax&quot;&#39;/&gt;
</pre>
    </div>
    <br />

   <a name="xsql_query" />
    <h4>15.16.2.10. xsql:query</h4>
    <p>This executes an SELECT statement and writes its result set into the resulting XML in some sort of ROWSET/ROW format.</p>
    <div>
      <pre class="programlisting">
&lt;xsql:query
  [ fetch-size=&quot;integer&quot; (allowed but ignored) ]
  [ id-attribute=&quot;calculateable_XML_NAME_string&quot; ]
  [ id-attribute-column=&quot;SQL_column_name&quot; ]
  [ max-rows=&quot;integer_SQL_expn&quot; (default is no limit) ]
  [ null-indicator=&quot;boolean&quot; (default value is &quot;no&quot;) ]
  [ row-element=&quot;calculateable_XML_NAME_string&quot; (default value is &quot;ROW&quot;) ]
  [ rowset-element=&quot;string&quot; (default value is &quot;ROWSET&quot;) ]
  [ skip-rows=&quot;integer_SQL_expn&quot; (default is no skip) ]
  [ tag-case=&quot;enum&quot; (could be &quot;lower&quot; or &quot;upper&quot;, default is &quot;lower&quot;) ]
&gt;
Text of SELECT statement, {@X} syntax is allowed.
&lt;/xsql:query&gt;
</pre>
    </div>
    <p>When no attributes is specified, the directive executes the SELECT statement and composes an XML fragment that
consists of ROWSET element that have one ROW child element per row of the result set of the executed statement.
Every ROW has one child element per result set column. The name of each element is made by converting column name to lowercase
and element values are serializations of result set fields. The procedure does not create elements for fields with NULL values
so an element with no text inside means empty string value but the totally missing element means NULL.
In addition, ROW element have so-called &quot;id attribute&quot; whose name is &#39;num&#39; and value is a number of the row in the result set.
    </p>
    <p>If attribute &#39;null-indicator&#39; is equal to &#39;1&#39; or &#39;yes&#39; then elements are created for both non-NULL and NULL field values.
Unlike elements that represent empty strings, element that represent NULL will have an attribute with name &#39;NULL&#39; and value &#39;Y&#39;.
    </p>
    <p>Attributes &#39;id-attribute&#39; and &#39;id-attribute-column&#39; configures the composing of &quot;id attribute&quot;.
&#39;id-attribute-column&#39; instructs to use the value specified SQL column as a value of attribute, &#39;id-attribute&#39; can specify
an attribute name other than default &#39;num&#39;.
    </p>
    <p>Attribute &#39;tag-case&#39; specifies the character case of elements for columns. This does not affect names for ROW and ROWSET elements.
    </p>
    <p>Element names ROW and ROWSET can be changed to whatever else by specifying attributes &#39;row-element&#39; and &#39;rowset-element&#39;.
Either or both of these elements can be omitted at all by specifying empty string value for appropriate attributes; this will prevent the result set from
proper parsing by some standard tools but may be convenient for special purposes.
Note that If &#39;row-element&#39; is empty string and ROW should not be created then attributes &#39;id-attribute&#39; and &#39;id-attribute-column&#39; should not be used.
    </p>
    <p>Attributes &#39;max-rows&#39; and &#39;skip-rows&#39; adds TOP N and SKIP N clauses to the specified SELECT statement.
They are supported mostly for compatibility. Attribute &#39;fetch-size&#39; is ignored at all.</p>
    <p>Note that Oracle allows the xsql:query to contain any code that produces a result set whereas Virtuoso allows only SELECT statement.</p>
    <div>
      <pre class="programlisting">
&lt;xsql:set-page-param name=&quot;usermask&quot; value=&quot;&#39;%DAV%&#39;&quot;/&gt;
&lt;xsql:query&gt;
-- This will produce the following XML fragment:
-- &lt;ROWSET&gt;
--   &lt;ROW num=&quot;1&quot;&gt;&lt;u_id&gt;3&lt;/u_id&gt;&lt;u_name&gt;administrators&lt;/u_name&gt;
--      &lt;u_full_name&gt;WebDAV Administrators&lt;/u_full_name&gt;&lt;ROW&gt;
--   &lt;ROW num=&quot;2&quot;&gt;&lt;u_id&gt;3&lt;/u_id&gt;&lt;u_name&gt;dav&lt;/u_name&gt;
--      &lt;u_full_name&gt;WebDAV System Administrator&lt;/u_full_name&gt;&lt;ROW&gt;
-- &lt;/ROWSET&gt;
SELECT U_ID, U_NAME, U_FULL_NAME from SYS_USERS where U_FULL_NAME like {@usermask}
&lt;/xsql:query&gt;
</pre>
    </div>
    <br />

   <a name="xsql_ref_cursor" />
    <h4>15.16.2.11. xsql:ref-cursor-function</h4>
    <p>This directive is not implemented in this version of Virtuoso Server.</p>
    <br />

   <a name="xsql_set_cookie" />
    <h4>15.16.2.12. xsql:set-cookie</h4>
    <p>This Oracle-specific directive is not implemented.</p>
    <br />

   <a name="xsql_set_page_param" />
    <h4>15.16.2.13. xsql:set-page-param</h4>
    <p>Declares a page parameter and assigns a value to it.</p>
    <div>
      <pre class="programlisting">
&lt;xsql:set-page-param
  name=&quot;XML_name&quot;
  [ ignore-empty-value=&quot;boolean&quot; ]
  [ value=&quot;SQL_expression&quot; ]
  [ xpath=&quot;XPATH_expression&quot; ]
&gt;
SQL expression, {@X} syntax is allowed, but only
for names that were declared above the current one.
&lt;/xsql:set-page-param&gt;
</pre>
    </div>
    <p>The declaration should contain either &#39;value&#39; attribute or &#39;xpath&#39; attribute or a SQL expression as a text inside element,
but not two or three of them simultaneously. The specified expression is calculated and the result is saved as a page variable with name specified by
&#39;name&#39; attribute. The resulting page variable can be used in other SQL expressions and calculateable strings of the page via
&#39;{@X}&#39; notation described in <a href="xsql.html#xsqlsyntax">XSQL Syntax</a> subsection above.</p>
    <p>If the directive uses &#39;xpath&#39; attribute, the XPATH expression is applied to the context XML of the page.
To apply an XPATH expression to some other XML entity, use <a href="">xpath_eval()</a>
function in SQL expression specified by &#39;value&#39; attribute or text inside the element.</p>
    <p>If attribute &#39;ignore-empty-value&#39; is set to &#39;yes&#39; or &#39;1&#39; and the value of the calculated expression is
an empty string then the page parameter is set to NULL.
This may be convenient for handling default values that are passed to the page from HTML forms.</p>
    <p>It is recommended to have names of parameters compatible with &quot;XML 1.1 unqualified name&quot; syntax.
Hence, it is better to use minus sign instead of underscore and avoid using unusual characters like spaces.
This become important when you use xsql:include-param because the name of create XML element will be equal to the name of parameter.</p>
    <div>
      <pre class="programlisting">
&lt;!-- string constant &#39;%DAV%&#39; is an SQL expression --&gt;
&lt;xsql:set-page-param name=&quot;user-mask&quot; value=&quot;&#39;%DAV%&#39;&quot;/&gt;
&lt;!-- SELECT statement is an expression too, but only when enclosed in parenthesis.
  Without parenthesis, it is an SQL operator but not an SQL expression. --&gt;
&lt;xsql:set-page-param name=&quot;user-id&quot;&gt;
(select U_ID from SYS_USERS where U_FULL_NAME like {@user-mask})
&lt;/xsql:set-page-param&gt;
&lt;!-- This copies implicit page argument &#39;context XML&#39;
  into plain page parameter &#39;my-context&#39; --&gt;
&lt;xsql:set-page-param name=&quot;my-context&quot; xpath=&quot;.&quot; /&gt;
</pre>
    </div>
    <br />

   <a name="xsql_set_session_param" />
    <h4>15.16.2.14. xsql:set-session-param</h4>
    <p>This Oracle-specific directive is not implemented.</p>
    <br />

   <a name="xsql_set_stylesheet_param" />
    <h4>15.16.2.15. xsql:set-stylesheet-param</h4>
    <p>This directive is not implemented.</p>
    <br />

   <a name="xsql_update_request" />
    <h4>15.16.2.16. xsql:insert-request</h4>
    <p>Updates the rows listed in context XML.</p>
    <div>
      <pre class="programlisting">
&lt;xsql:update-request
  key-columns=&quot;column_list&quot;
  table=&quot;table_name&quot;
  [ columns=&quot;column_list&quot; ]
  [ date-format=&quot;string&quot; (allowed but ignored) ]
  [ transform=&quot;calculateable_URI_string&quot; ]
/&gt;
</pre>
    </div>
    <p>The directive updates a table by changing rows listed in the context XML.
The destination table is specified by &#39;table&#39; attribute.
</p>
    <p>If &#39;transform&#39; URI is specified then it is used as a name of XSLT stylesheet that is applied to the
context XML before the rest of processing. The result of that stylesheet should be in standard ROWSET/ROW form.
The result may also contain redundant elements but they will be silently ignored.
</p>
    <p>After this optional XSLT transformation, the XSQL procedure gets all ROW elements in all top-level ROWSET
elements of the source. For each such element it parses all subelements whose names match column names listed in
the &#39;key-columns&#39; attribute or in the &#39;columns&#39; attribute;
if the &#39;columns&#39; attribute is not specified then it works as if all column names from the destination table are listed in &#39;columns&#39;.
It is legal to have a ROW element that does not contain an element that matches a particular column; the missing element is
treated as a database NULL. If a subelement of ROW has attribute &#39;NULL&#39; equal to &#39;Y&#39; then it is also treated as
database NULL.</p>
    <p>When required subelements of ROW are parsed, the procedure updates all rows in the table that have all values of key columns equal to
values listed in ROW. All these rows are updated by values from subelements of ROW.
If &#39;columns&#39; is specified then only named fields are updated; otherwise, the update operation changes all fields of a table.</p>
    <p>
When the update operation is complete, the procedure parses all subelements of the next ROW element in queue and so on.</p>
    <div>
      <pre class="programlisting">
&lt;xsql:insert-request table=&#39;&quot;Demo&quot;.&quot;demo&quot;.&quot;Customers&quot;&#39; columns=&#39;&quot;CustomerID&quot;, &quot;Phone&quot;, &quot;Fax&quot;&#39;/&gt;
</pre>
    </div>
    <br />

 <br />
<table border="0" width="90%" id="navbarbottom">
    <tr>
        <td align="left" width="33%">
          <a href="bpel.html" title="BPEL Reference">Previous</a>
          <br />BPEL Reference</td>
     <td align="center" width="34%">
          <a href="webservices.html">Chapter Contents</a>
     </td>
        <td align="right" width="33%">
          <a href="runtimehosting.html" title="Runtime Hosting">Next</a>
          <br />Contents of Runtime Hosting</td>
    </tr>
    </table>
  </div>
  <div id="footer">
    <div>Copyright© 1999 - 2009 OpenLink Software All rights reserved.</div>
   <div id="validation">
    <a href="http://validator.w3.org/check/referer">
        <img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0!" height="31" width="88" />
    </a>
    <a href="http://jigsaw.w3.org/css-validator/">
        <img src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!" height="31" width="88" />
    </a>
   </div>
  </div>
 </body>
</html>