Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 179 lines (146 sloc) 3.235 kB
cdf770d @docelic * Improved table-editor attribute listing
docelic authored
1 __NAME__ purpose
2 retrieve column names from a database table
3 __END__
4
da86c51 @docelic - Added a few todo items and small fixes here and there
docelic authored
5 __NAME__ synopsis
6 <row>
7
8 <entry>
cdf770d @docelic * Improved table-editor attribute listing
docelic authored
9 <group>
10 <arg choice='plain'>name</arg>
11 <arg choice='plain'>table</arg>
da86c51 @docelic - Added a few todo items and small fixes here and there
docelic authored
12 </group>
13 </entry>
14 <entry>
15 Yes
16 </entry>
17 <entry>
18 <!-- REQ -->
19 </entry>
20 <entry>
21 <!-- DFL -->
22 </entry>
23 <entry>
cdf770d @docelic * Improved table-editor attribute listing
docelic authored
24 Name of the &glos-database; table.
da86c51 @docelic - Added a few todo items and small fixes here and there
docelic authored
25 </entry>
26
27 </row>
28 <row>
29
30 <entry>
cdf770d @docelic * Improved table-editor attribute listing
docelic authored
31 <group>
32 <arg choice='plain'>fields</arg>
33 <arg choice='plain'>columns</arg>
da86c51 @docelic - Added a few todo items and small fixes here and there
docelic authored
34 </group>
35 </entry>
36 <entry>
37 Yes
38 </entry>
39 <entry>
40 <!-- REQ -->
41 </entry>
42 <entry>
43 <!-- DFL -->
44 </entry>
45 <entry>
cdf770d @docelic * Improved table-editor attribute listing
docelic authored
46 Manually specify columns to be returned.
da86c51 @docelic - Added a few todo items and small fixes here and there
docelic authored
47 </entry>
48
49 </row>
50 <row>
51
52 <entry>
53 joiner
54 </entry>
55 <entry>
56 Yes
57 </entry>
58 <entry>
59 <!-- REQ -->
60 </entry>
61 <entry>
62 <literal>\n</literal>
63 </entry>
64 <entry>
cdf770d @docelic * Improved table-editor attribute listing
docelic authored
65 String joiner to use if column list is requested in &PERL;
66 <literal>scalar</literal> context.
da86c51 @docelic - Added a few todo items and small fixes here and there
docelic authored
67 </entry>
68
69 </row>
70 <row>
71
72 <entry>
73 passed_order
74 </entry>
75 <entry>
76 <!-- POS -->
77 </entry>
78 <entry>
79 <!-- REQ -->
80 </entry>
81 <entry>
cdf770d @docelic * Improved table-editor attribute listing
docelic authored
82 0
da86c51 @docelic - Added a few todo items and small fixes here and there
docelic authored
83 </entry>
84 <entry>
cdf770d @docelic * Improved table-editor attribute listing
docelic authored
85 With <literal>columns=</literal>, return columns in the
86 passed order instead of table order?
da86c51 @docelic - Added a few todo items and small fixes here and there
docelic authored
87 </entry>
88
89 </row>
cdf770d @docelic * Improved table-editor attribute listing
docelic authored
90 &TAG_CONTAINER;
91 __END__
da86c51 @docelic - Added a few todo items and small fixes here and there
docelic authored
92
cdf770d @docelic * Improved table-editor attribute listing
docelic authored
93 __NAME__ description
94 &tag-__FILENAME__; returns the list of columns in a
95 &glos-database; table.
96 __END__
da86c51 @docelic - Added a few todo items and small fixes here and there
docelic authored
97
cdf770d @docelic * Improved table-editor attribute listing
docelic authored
98 __NAME__ notes
99 A side effect of specifying <literal>passed_order=1</literal> is the
100 removal of invalid column names from the <literal>columns=</literal>
101 list; column names not present in the database table are filtered out,
102 instead of being returned regardless.
103 __END__
da86c51 @docelic - Added a few todo items and small fixes here and there
docelic authored
104
cdf770d @docelic * Improved table-editor attribute listing
docelic authored
105 __NAME__ example: looping over column list from the products table
106 <programlisting><![CDATA[
107 <pre>
108 [loop list="[db-columns products]"]
109 Column: [loop-code]
110 [/loop]
111 </pre>
112 ]]></programlisting>
113 __END__
da86c51 @docelic - Added a few todo items and small fixes here and there
docelic authored
114
cdf770d @docelic * Improved table-editor attribute listing
docelic authored
115 __NAME__ example: looping over column list, without using db_columns
116 It is possible to list table columns manually without the use of
117 &tag-db_columns;. The output will be satisfactory as long as you don't
118 need db_column's <literal>columns=</literal> attribute.
da86c51 @docelic - Added a few todo items and small fixes here and there
docelic authored
119
cdf770d @docelic * Improved table-editor attribute listing
docelic authored
120 <programlisting><![CDATA[
121 [perl tables=products]
122 $Scratch->{columns} = join ' ', $Db{products}->columns;
123 return;
124 [/perl]
da86c51 @docelic - Added a few todo items and small fixes here and there
docelic authored
125
cdf770d @docelic * Improved table-editor attribute listing
docelic authored
126 <pre>
127 [loop list="[scratch columns]"]
128 Column: [loop-code]
129 [/loop]
130 </pre>
131 ]]></programlisting>
da86c51 @docelic - Added a few todo items and small fixes here and there
docelic authored
132 __END__
cdf770d @docelic * Improved table-editor attribute listing
docelic authored
133
134
135
136
137
138
139 From docelic at mail.inet.hr Thu Nov 4 17:16:15 2004
140 From: docelic at mail.inet.hr (Davor Ocelic)
141 Date: Thu Nov 4 17:16:31 2004
142 Subject: [interchange-core] db_columns UI tag
143 Message-ID: <20041104231615.2aee658c.docelic@mail.inet.hr>
144
145
146 Hi,
147
148 The db_columns UI tag isn't documented so I can't compare the source
149 with intended behavior, but the tag has some problems:
150
151 In this code block:
152
153 if($passed_order) {
154 @col{@allcols} = @allcols;
155 @allcols = @cols;
156
157 my $found;
158 for(@cols) {
159 next unless $_ eq $key;
160 $found = 1;
161 last;
162 }
163 #
164 unshift (@allcols, $key) if ! $found;
165 }
166
167
168 Everything after the first line (@col{@allcols} = @allcols)
169 has no effect on the execution.
170
171 Besides, looks like the tag tries to ensure that $key is
172 always included in the set of returned column names, but
173 it doesn't succeed in doing so (at least if columns=
174 is specified by user).
175
176 Since the docs aren't available, I'd like someone more
177 familiar with this to check-in a fix if I'm right.
178
Something went wrong with that request. Please try again.