]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - pgsrc/Help%2FSqlResultPlugin
Let us say this is PhpWiki 1.4.0
[SourceForge/phpwiki.git] / pgsrc / Help%2FSqlResultPlugin
1 Date: Thu,  9 Dec 2010 19:59:28 +0000
2 Mime-Version: 1.0 (Produced by PhpWiki 1.4.0)
3 X-Rcs-Id: $Id$
4 Content-Type: application/x-phpwiki;
5   pagename=Help%2FSqlResultPlugin;
6   flags=PAGE_LOCKED;
7   markup=2;
8   charset=UTF-8
9 Content-Transfer-Encoding: binary
10
11 The **~SqlResult** [[Help:WikiPlugin|plugin]] displays results of arbitrary SQL select statements in table form.
12
13 The database definition, the DSN, must be defined in the local file ##config/SqlResult.ini##
14
15 A simple textfile with alias = dsn lines.
16
17 Optional template file to format the result and handle some logic.
18
19 Template vars: %%where%%, %%sortby%%, %%limit%%
20
21 == Usage ==
22 {{{
23 <<SqlResult parameters
24 SELECT statement
25 >>
26 }}}
27
28 == Arguments ==
29
30 {| class="bordered"
31 |-
32 ! Argument
33 ! Description
34 ! Default value
35 |-
36 | **alias**
37 | DSN database specification
38 | false
39 |-
40 | **ordered**
41 | if to display as {{{<ol>}}} list: single col only without template
42 | false
43 |-
44 | **template**
45 | use a custom {{{<theme>/template.tmpl}}}
46 | false
47 |-
48 | **where**
49 | custom filter for the query
50 | false
51 |-
52 | **sortby**
53 | for paging
54 | false (no paging)
55 |-
56 | **limit**
57 | for paging
58 | 0,50 (only the first 50)
59 |}
60
61 == Examples ==
62
63 {{{
64 <<SqlResult alias=mysql
65          SELECT 'mysql password for string "xx":',
66                 PASSWORD('xx')
67 >>
68
69 <<SqlResult alias=videos template=videos
70          SELECT rating,title,date
71                 FROM video
72                 ORDER BY rating DESC
73                 LIMIT 5
74 >>
75
76 <<SqlResult alias=imdb template=imdbmovies where||="Davies, Jeremy%"
77 SELECT m.title, m.date, n.name, c.role
78   FROM movies as m, names as n, jobs as j, characters as c
79   WHERE n.name LIKE "%%where%%"
80   AND m.title_id = c.title_id
81   AND n.name_id = c.name_id
82   AND c.job_id = j.job_id
83   AND j.description = 'Actor'
84   ORDER BY m.date DESC
85 >>
86 }}}
87
88 == Author ==
89 * [[PhpWiki:ReiniUrban|Reini Urban]]
90
91 == See Also ==
92
93 <noinclude>
94 ----
95 [[PhpWikiDocumentation]] [[CategoryWikiPlugin]]
96 </noinclude>