File: vc_data_source.xml

package info (click to toggle)
virtuoso-opensource 6.1.2%2Bdfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 213,384 kB
  • ctags: 120,485
  • sloc: ansic: 631,183; sql: 420,245; xml: 272,257; java: 62,959; sh: 39,240; cpp: 37,890; cs: 24,942; php: 12,251; yacc: 8,812; lex: 7,135; makefile: 6,331; jsp: 3,739; asm: 3,281; ada: 1,681; awk: 1,639; pascal: 1,089; perl: 1,017; ruby: 1,000; python: 329
file content (349 lines) | stat: -rw-r--r-- 15,285 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
<refentry id="vc_data_source">
  <refmeta>
  <refentrytitle>data-source</refentrytitle>
  <refmiscinfo>vspx_control</refmiscinfo>
  </refmeta>
  <refnamediv>
  <refname>data-source</refname>
  <refpurpose>Scrollable multi-row data bound source.</refpurpose>
  </refnamediv>
  <refsynopsisdiv>
   <funcsynopsis id="vc_syn_data_source">
    <funcprototype id="vc_proto_data_source">
      <funcdef>
            &lt;<function>data-source</function> <attribute>
          <parameter>name</parameter> (required) </attribute>
        <attribute>
          <parameter>annotation</parameter> (optional) </attribute>
        <attribute>
          <parameter>initial-enable</parameter> (optional) </attribute>
        <attribute>
          <parameter>enabled</parameter> (optional) </attribute>
        <attribute>
          <parameter>instantiate</parameter> (optional) </attribute>
        <attribute>
          <parameter>control-udt</parameter> (optional) </attribute>
        <attribute>
          <parameter>xsd-stub-xhtml</parameter> (optional) </attribute>
        <attribute>
          <parameter>width</parameter> (optional) </attribute>
        <attribute>
          <parameter>height</parameter> (optional) </attribute>
        <attribute>
          <parameter>expression-type</parameter> (required) </attribute>
        <attribute>
          <parameter>nrows</parameter> (optional) </attribute>
        <attribute>
          <parameter>initial-offset</parameter> (optional) </attribute>
        <attribute>
          <parameter>data</parameter> (optional) </attribute>
        <attribute>
          <parameter>meta</parameter> (optional) </attribute>
        <attribute>
          <parameter>debug-srcfile</parameter> (optional) </attribute>
        <attribute>
          <parameter>debug-srcline</parameter> (optional) </attribute>
        <attribute>
          <parameter>debug-log</parameter> (optional) </attribute>
 /&gt;</funcdef>
    </funcprototype>
   </funcsynopsis>
  </refsynopsisdiv>
  <refsect1 id="vc_desc_data_source">
  <title>Description</title>
  <para>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.
      </para>
  </refsect1>
  <refsect1 id="vc_attrs_data_source">
  <title>Attributes</title>
  <formalpara>
   <title>name = <link linkend="vc_type_SqlName">SqlName</link>
   </title>
    <para>A page level unique name identifying a control.</para>
  </formalpara>
  <formalpara>
    <title>annotation</title>
    <para>A human readable comment.</para>
  </formalpara>
  <formalpara>
   <title>initial-enable = <link linkend="vc_type_CalculateableValue">CalculateableValue</link>
   </title>
    <para>Determines  whether  a control is initially visible. True by default. Could be data-bound to an SQL expression.</para>
  </formalpara>
  <formalpara>
   <title>enabled = <link linkend="vc_type_CalculateableValue">CalculateableValue</link>
   </title>
    <para>Determines  whether  a control is visible. True by default. Could be data-bound to an SQL expression.</para>
  </formalpara>
  <formalpara>
   <title>instantiate = <link linkend="vc_type_CalculateableValue">CalculateableValue</link>
   </title>
    <para>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.</para>
  </formalpara>
  <formalpara>
   <title>control-udt = <link linkend="vc_type_SqlName">SqlName</link>
   </title>
    <para>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.</para>
  </formalpara>
  <formalpara>
    <title>xsd-stub-xhtml</title>
    <para>This attribute is for internal use only. It has no effect if added to the source VSPX file.</para>
  </formalpara>
  <formalpara>
    <title>width</title>
    <para>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.</para>
  </formalpara>
  <formalpara>
    <title>height</title>
    <para>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.</para>
  </formalpara>
  <formalpara>
    <title>expression-type</title>
    <para>Denotes the type of &#39;expression&#39;</para>
   <table>
      <title>Allowed values of the &#39;expression-type&#39; attribute</title>
    <tgroup cols="2">
     <tbody>
      <row>
            <entry>SQL</entry>
       <entry>
              <para>The expression is a SQL select statement</para>
       </entry>
      </row>
      <row>
            <entry>TABLE</entry>
       <entry>
              <para>The expression is a table reference</para>
       </entry>
      </row>
      <row>
            <entry>PROCEDURE</entry>
       <entry>
              <para>The expression is a procedure call</para>
       </entry>
      </row>
      <row>
            <entry>ARRAY</entry>
       <entry>
              <para>The rowset is already prepared and supplied as an array of arrays</para>
       </entry>
      </row>
     </tbody>
    </tgroup>
   </table>
  </formalpara>
  <formalpara>
   <title>nrows = <link linkend="vc_type_CalculateableValue">CalculateableValue</link>
   </title>
    <para>The maximum number of rows to be selected.
It is like the rowset size for a scrollable cursor.
</para>
  </formalpara>
  <formalpara>
   <title>initial-offset = <link linkend="vc_type_CalculateableValue">CalculateableValue</link>
   </title>
    <para>Number of record to start data binding of rowset</para>
  </formalpara>
  <formalpara>
   <title>data = <link linkend="vc_type_CalculateableValue">CalculateableValue</link>
   </title>
    <para>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:</para>
<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; )
)
</programlisting>
</formalpara>
  <formalpara>
   <title>meta = <link linkend="vc_type_CalculateableValue">CalculateableValue</link>
   </title>
    <para>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; :
</para>

<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 )
)
</programlisting>

<para>for details of metadata see &#39;exec()&#39; function description.</para>
</formalpara>
  <formalpara>
    <title>debug-srcfile</title>
    <para>URI of the source document where the tag comes from.</para>
  </formalpara>
  <formalpara>
    <title>debug-srcline</title>
    <para>Line number in the source document where the tag comes from.</para>
  </formalpara>
  <formalpara>
    <title>debug-log</title>
    <para>This defines what sort of data are saved to the debugging log.
</para>
  </formalpara>
  </refsect1>
  <refsect1 id="vc_udt_data_source">
  <title>Declaration of type vspx_data_source</title>
  <para>
</para>
  <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)
</screen>
  </refsect1>
  <refsect1 id="vc_ex_data_source">
  <title>Examples</title>
   <example id="vc_ex_data_source__0">
    <title>
  Simple navigation form using invisible data-source control
</title>
    <para>
&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.

</para>
    <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;
</screen>
   </example>
  </refsect1>
</refentry>