Table of Contents
sql2wiki Plugin
Compatible with DokuWiki
- 2024-02-06 "Kaos" unknown
- 2023-04-04 "Jack Jackrum" yes
- 2022-07-31 "Igor" yes
- 2020-07-29 "Hogfather" unknown
Similar to dbquery
Usage
This plugin allows you to save the results of sqlite named queries into wiki syntax. Unlike other similar plugins, the results of queries are saved directly to the page source. Every change in the results of queries creates a new page revision. This might be useful when you need to track the changes in your results.
To use the plugin you must first create a named query in sqlite plugin admin interface. Then you can refer to the query anywhere in the wiki using the following syntax:
<sql2wiki db="db_name" query="name of the query"></sql2wiki>
After saving the page another page edit will be performed by the plugin which will populate results. The result will be added to page content in CSV format between the <sql2wiki></sql2wiki>
tag.
In addition to refreshing the results after the page save, the plugin also tracks the changes in SQLite databases and updates the page source if needed.
Syntax
<sql2wiki db="..." query="..." args="..." parser_0="..." parser_1="..."></sql2wiki>
The <sql2wiki>
tag is parsed as an XML tag with the following arguments:
db
- the sqlite databasequery
- the name of the named queryargs
- comma-separated list of arguments to the query. This can be useful when you want to use one query in different contexts on different pages. The args replace the quotation marks?
placeholders defined in the query. The special variables:$ID$
,$NS$
and$PAGE$
can be used.parser_N
(requires struct plugin) - defines the struct value parser for the N-th column in the SQL result table. This can be the name of any type class that extendsAbstractBaseType
. Additionally, you can specify the $config parameter for the type class. Examples:Wiki
,Page({“usetitles”:true})