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