Sophie

Sophie

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

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="OpenLink Virtuoso Universal Server: Documentation" />
  <meta name="dc.subject" content="OpenLink Virtuoso Universal Server: Documentation" />
  <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=".html" title="Chapter Contents" />
  <link rel="prev" href="index.html" title="Home" />
  <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>OpenLink Virtuoso Universal Server: Documentation</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="vc_data_source" />
    <img src="../images/misc/logo.jpg" alt="" />
    <h1>OpenLink Virtuoso Universal Server: Documentation - data-source</h1>
  </div>
  <div id="navbartop">
   <div>
      <a class="link" href="functions.html">Chapter Contents</a> | <a class="link" href="index.html" title="Home">Prev</a> | <a class="link" href="contents.html" title="Contents">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>
      <a href="overview.html">Overview</a>
   </div>
   <div>
      <a href="installation.html">Installation Guide</a>
   </div>
   <div>
      <a href="quicktours.html">Quick Start &amp; Tours</a>
   </div>
   <div>
      <a href="sampleapps.html">Sample ODBC &amp; JDBC Applications</a>
   </div>
   <div>
      <a href="concepts.html">Conceptual Overview</a>
   </div>
   <div>
      <a href="server.html">Administration</a>
   </div>
   <div>
      <a href="accessinterfaces.html">Data Access Interfaces</a>
   </div>
   <div>
      <a href="sqlreference.html">SQL Reference</a>
   </div>
   <div>
      <a href="sqlprocedures.html">SQL Procedure Language Guide</a>
   </div>
   <div>
      <a href="hooks.html">Database Event Hooks</a>
   </div>
   <div>
      <a href="repl.html">Data Replication, Synchronization and Transformation Services</a>
   </div>
   <div>
      <a href="webappdevelopment.html">Web Application Development</a>
   </div>
   <div>
      <a href="webandxml.html">XML Support</a>
   </div>
   <div>
      <a href="rdfandsparql.html">RDF Data Access and Data Management</a>
   </div>
   <div>
      <a href="webservices.html">Web Services</a>
   </div>
   <div>
      <a href="runtimehosting.html">Runtime Hosting</a>
   </div>
   <div>
      <a href="internetservices.html">Internet Services</a>
   </div>
   <div>
      <a href="freetext.html">Free Text Search</a>
   </div>
   <div>
      <a href="tpcc.html">TPC C Benchmark Kit</a>
   </div>
   <div>
      <a href="xa.html">Using Virtuoso with Tuxedo</a>
   </div>
   <div>
      <a href="appendixa.html">Appendix</a>
   </div>
   <div>
      <a href="functions.html">Virtuoso Functions Guide</a>
   </div>
    <br />
  </div>
  <div id="text">
    <h2>data-source</h2>
    <div class="refpurpose">Scrollable multi-row data bound source.</div>
    <div class="funcsynopsis">
        <span class="funcdef">
            &lt;<a href="vc_data_source.html">
          <span class="function">data-source</span>
        </a> 
            name (required) 
          
            annotation (optional) 
          
            initial-enable (optional) 
          
            enabled (optional) 
          
            instantiate (optional) 
          
            control-udt (optional) 
          
            xsd-stub-xhtml (optional) 
          
            width (optional) 
          
            height (optional) 
          
            expression-type (required) 
          
            nrows (optional) 
          
            initial-offset (optional) 
          
            data (optional) 
          
            meta (optional) 
          
            debug-srcfile (optional) 
          
            debug-srcline (optional) 
          
            debug-log (optional) 
 /&gt;</span>
    </div>
  
  
  
  <div class="refsect1">
    <div class="refsect1title">Description</div>
    <p>Invisible multi-row data source.
      This control is an invisible represantation of a result set. Also it offer a
      number of methods for accessing and updating the data. It can be used as a source in
      the data-set control or as a separate data source for various form controls (such as label, url etc.).
      This control is using &#39;SELECT TOP N,M ..&#39; statements to bind the data into the resultset (when source is a table or SQL statement), hence this should be taken into account when using it.
      </p>
  </div>
  <div class="refsect1">
    <div class="refsect1title">Attributes</div>
  <div class="formalpara">
   <strong>name = <a href="vc_type_SqlName.html">SqlName</a>
   </strong>
      <p>A page level unique name identifying a control.</p>
  </div>
  <div class="formalpara">
      <strong>annotation</strong>
      <p>A human readable comment.</p>
  </div>
  <div class="formalpara">
   <strong>initial-enable = <a href="vc_type_CalculateableValue.html">CalculateableValue</a>
   </strong>
      <p>Determines  whether  a control is initially visible. True by default. Could be data-bound to an SQL expression.</p>
  </div>
  <div class="formalpara">
   <strong>enabled = <a href="vc_type_CalculateableValue.html">CalculateableValue</a>
   </strong>
      <p>Determines  whether  a control is visible. True by default. Could be data-bound to an SQL expression.</p>
  </div>
  <div class="formalpara">
   <strong>instantiate = <a href="vc_type_CalculateableValue.html">CalculateableValue</a>
   </strong>
      <p>Determines whether a control instantiate its children. It is true by default. It could be data-bound to an SQL expression. Unlike most of calcucateable attributes, the value of this attribute for a control is calcluated before calling &#39;on-init&#39; event handler of the control; other values are calculated before calling &#39;before-data-bind&#39; event handler.</p>
  </div>
  <div class="formalpara">
   <strong>control-udt = <a href="vc_type_SqlName.html">SqlName</a>
   </strong>
      <p>At run time every control is represented as an instance of some user-defined type (UDT). VSPX compiles selects the UDT to use depending on name of the XML element that represents the control and maybe some of its attributes. In some specific cases the application developer may instruct VSPX compiler to use some other UDT, e.g. an application-specific UDT that is derived from the preset one. If specified, the value of &#39;control-udt&#39; attribute should be equal to the name of the desired target UDT.</p>
  </div>
  <div class="formalpara">
      <strong>xsd-stub-xhtml</strong>
      <p>This attribute is for internal use only. It has no effect if added to the source VSPX file.</p>
  </div>
  <div class="formalpara">
      <strong>width</strong>
      <p>Visible width of the control when it is displayed in WYSIWYG tools when the source VSPX text is edited.
The value of this attribute will not be used when the resulting HTML is rendered.</p>
  </div>
  <div class="formalpara">
      <strong>height</strong>
      <p>Visible width of the control when it is displayed in WYSIWYG tools when the source VSPX text is edited.
The value of this attribute will not be used when the resulting HTML is rendered.</p>
  </div>
  <div class="formalpara">
      <strong>expression-type</strong>
      <p>Denotes the type of &#39;expression&#39;</p>
   <table class="data">
        <caption>Table: 12.4.9.1. Allowed values of the &#39;expression-type&#39; attribute</caption>
    
     
      <tr>
              <td class="data">SQL</td>
       <td class="data">
                <p>The expression is a SQL select statement</p>
       </td>
      </tr>
      <tr>
              <td class="data">TABLE</td>
       <td class="data">
                <p>The expression is a table reference</p>
       </td>
      </tr>
      <tr>
              <td class="data">PROCEDURE</td>
       <td class="data">
                <p>The expression is a procedure call</p>
       </td>
      </tr>
      <tr>
              <td class="data">ARRAY</td>
       <td class="data">
                <p>The rowset is already prepared and supplied as an array of arrays</p>
       </td>
      </tr>
     
    
   </table>
        <br />
  </div>
  <div class="formalpara">
   <strong>nrows = <a href="vc_type_CalculateableValue.html">CalculateableValue</a>
   </strong>
      <p>The maximum number of rows to be selected.
It is like the rowset size for a scrollable cursor.
</p>
  </div>
  <div class="formalpara">
   <strong>initial-offset = <a href="vc_type_CalculateableValue.html">CalculateableValue</a>
   </strong>
      <p>Number of record to start data binding of rowset</p>
  </div>
    <div class="formalpara">
   <strong>data = <a href="vc_type_CalculateableValue.html">CalculateableValue</a>
   </strong>
      <p>When this attribute is specified it must be an
expression returning array of arrays. This is an alternative to specifying an
SQL expression or data-source. The result then will be used to instantiate
the repeating group. An example of such data is the result returned by &#39;exec&#39; function:</p>
<div>
          <pre class="programlisting">
(
  (&quot;ALFKI&quot; &quot;Alfreds Futterkiste&quot; &quot;030-0074321&quot; )
  (&quot;ANATR&quot; &quot;Ana Trujillo Emparedados y helados&quot; &quot;(5) 555-4729&quot; )
)
</pre>
        </div>
</div>
    <div class="formalpara">
   <strong>meta = <a href="vc_type_CalculateableValue.html">CalculateableValue</a>
   </strong>
      <p>This attribute is used together with &#39;data&#39;, so when is
specified it needs to be an expression returning a meta-data for columns corresponding to the
these returned by &#39;data&#39; expression. In practice it&#39;s same as 1-st element of metadata returned by &#39;exec()&#39; :
</p>

<div>
          <pre class="programlisting">
(
  (&quot;CustomerID&quot; 182 0 5 0 1 1 &quot;Demo&quot; &quot;CustomerID&quot; &quot;demo&quot; &quot;Customers&quot; 0 )
  (&quot;CompanyName&quot; 182 0 40 1 1 1 &quot;Demo&quot; &quot;CompanyName&quot; &quot;demo&quot; &quot;Customers&quot; 0 )
  (&quot;Phone&quot; 182 0 24 1 1 1 &quot;Demo&quot; &quot;Phone&quot; &quot;demo&quot; &quot;Customers&quot; 0 )
)
</pre>
        </div>

<p>for details of metadata see &#39;exec()&#39; function description.</p>
</div>
  <div class="formalpara">
      <strong>debug-srcfile</strong>
      <p>URI of the source document where the tag comes from.</p>
  </div>
  <div class="formalpara">
      <strong>debug-srcline</strong>
      <p>Line number in the source document where the tag comes from.</p>
  </div>
  <div class="formalpara">
      <strong>debug-log</strong>
      <p>This defines what sort of data are saved to the debugging log.
</p>
  </div>
  </div>
  <div class="refsect1">
    <div class="refsect1title">Declaration of type vspx_data_source</div>
    <p>
</p>
    <div>
        <pre class="screen">
create type vspx_data_source under vspx_control
as    (
    ds_row_meta any,      -- metadata
    ds_row_data any,      -- data coming from a function, rowset
    ds_array_data any,    -- data coming from @data=... where @expression-type=&#39;array&#39;
    ds_rows_fetched int default 0,  -- these are to keep state for scrolling
    ds_rows_offs    int default 0,  -- this is the pos of row at 0 offset
    ds_nrows int,     -- how many rows to show on single page
    ds_total_pages int default 0,
    ds_current_page int default 0,
    ds_current_pager_idx int default 0,
    ds_npages int default 10,
    ds_first_page int default 0,
    ds_last_page int default 0,
    ds_total_rows int default 0,
    ds_prev_bookmark any default null,
    ds_next_bookmark any default null,
    ds_parameters any default null,
    ds_columns any default null,
    ds_sql varchar default null,
    ds_sql_type varchar default &#39;sql&#39;,
    ds_current_inx int default 0,
    ds_update_inx int default -1,
    ds_tables any default null,
    ds_insert any default null,
    ds_update any default null,
    ds_delete any default null,
    ds_rb_data any default null,
    ds_have_more any default null
      )
temporary self as ref
method set_parameter (num any, value any) returns any,
method get_parameter (num any) returns any,
method add_parameter (value any) returns any,
method delete_parameter (num any) returns any,
method get_column_name (num any) returns any,
method set_column_label (num any, value any) returns any,
method get_column_label (num any) returns any,
method get_column_label (col varchar) returns any,
--method set_column_add_style (num int, style any) returns any,
--method get_column_add_style (num int) returns any,
--method set_column_edit_style () returns any,
--method get_column_edit_style () returns any,
--method set_column_browse_style () returns any,
--method get_column_browse_style () returns any,
--method set_column_add_format () returns any,
--method get_column_add_format () returns any,
--method set_column_edit_format () returns any,
--method get_column_edit_format () returns any,
--method set_column_browse_format () returns any,
--method get_column_browse_format () returns any,
method set_item_value (row any, col any, value any) returns any,
method set_item_value (col varchar, value any) returns any,
method get_item_value (row any, col any) returns any,
method get_rb_item_value (row any, col any) returns any,
method get_item_value (col any) returns any,
method get_item_value (col varchar) returns any,
method set_expression (expression varchar) returns any,
method get_expression () returns varchar,
method set_expression_type (type varchar) returns any,
method get_expression_type () returns varchar,
method reset () returns any,
method ds_data_bind (e vspx_event) returns any,
method ds_make_statistic () returns any,
method ds_insert (e vspx_event) returns any,
method ds_update (e vspx_event) returns any,
method ds_delete (e vspx_event) returns any,
method ds_key_params (tbl varchar) returns any,
method ds_tbl_params (tbl varchar) returns any,
method get_current_row () returns any,
constructor method vspx_data_source (name varchar, parent vspx_control)
</pre>
      </div>
  </div>
  <div class="refsect1">
    <div class="refsect1title">Examples</div>
   <a name="vc_ex_data_source__0" />
      <div class="example">
      <div class="exampletitle">
  Simple navigation form using invisible data-source control
</div>
      <p>
&lt;?xml version=&quot;1.0&quot;?&gt;
&lt;!--
 -  
 -  $Id: data_source__0.vspx,v 1.2 2006/08/16 00:04:15 source Exp $
 -
 -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 -  project.
 -  
 -  Copyright (C) 1998-2006 OpenLink Software
 -  
 -  This project is free software; you can redistribute it and/or modify it
 -  under the terms of the GNU General Public License as published by the
 -  Free Software Foundation; only version 2 of the License, dated June 1991.
 -  
 -  This program is distributed in the hope that it will be useful, but
 -  WITHOUT ANY WARRANTY; without even the implied warranty of
 -  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 -  General Public License for more details.
 -  
 -  You should have received a copy of the GNU General Public License along
 -  with this program; if not, write to the Free Software Foundation, Inc.,
 -  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 -  
 -  


This example will show a cell of the customers table from the Northwind demo database.
Allows to show different columns : name and phone.

</p>
      <div>
          <pre class="screen">
&lt;v:page name=&quot;data_source__0&quot; xmlns:v=&quot;http://www.openlinksw.com/vspx/&quot;&gt;
&lt;html&gt;
&lt;body&gt;
&lt;v:variable name=&quot;offset&quot; default=&quot;0&quot; type=&quot;int&quot;/&gt;
   &lt;v:form name=&quot;f1&quot; method=&quot;POST&quot; type=&quot;simple&quot;&gt;
   &lt;div&gt;There is a hidden data-source on &quot;&lt;?V self.datasource1.ds_sql ?&gt;&quot;&lt;/div&gt;
   &lt;v:data-source name=&quot;datasource1&quot; expression-type=&quot;sql&quot; nrows=&quot;10&quot; initial-offset=&quot;--self.offset&quot;&gt;
     &lt;v:expression&gt;
       select * from Demo.demo.Customers where CustomerID like ? order by CompanyName desc
     &lt;/v:expression&gt;
     &lt;v:param name=&quot;mask&quot; value=&quot;--(&#39;L%&#39;)&quot;/&gt;
     &lt;v:column name=&quot;CompanyName&quot; label=&quot;Company Name&quot; input-format=&quot;%s&quot; output-format=&quot;%s&quot;/&gt;
     &lt;v:column name=&quot;Phone&quot; label=&quot;Telephone&quot; input-format=&quot;%s&quot; output-format=&quot;%s&quot; /&gt;
   &lt;/v:data-source&gt;
   &lt;div&gt;
   row #: &lt;v:text name=&quot;r1&quot; value=&quot;0&quot; /&gt;&lt;br /&gt;
   col #: &lt;v:text name=&quot;c1&quot; value=&quot;0&quot; /&gt;&lt;br /&gt;
   Seek : &lt;v:button action=&quot;simple&quot; name=&quot;b1&quot; value=&quot;OK&quot; /&gt;
   &lt;/div&gt;
   &lt;div&gt;
   &quot;&lt;v:label name=&quot;l1&quot; value=&quot;--self.datasource1.get_column_label (atoi(self.c1.ufl_value))&quot; /&gt;&quot; =
   &lt;v:label name=&quot;l2&quot; value=&quot;--self.datasource1.get_item_value (atoi(self.r1.ufl_value),atoi(self.c1.ufl_value))&quot;/&gt;
   &lt;/div&gt;
    &lt;v:on-post&gt;
      self.l1.vc_data_bind (e);
      self.l2.vc_data_bind (e);
    &lt;/v:on-post&gt;
   &lt;/v:form&gt;
&lt;/body&gt;
&lt;/html&gt;
&lt;/v:page&gt;
</pre>
        </div>
   </div>
  </div>
</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>