Table of Contents

SQL JSON Plugin

Compatible with DokuWiki

No compatibility info given!

plugin Processing query to MySQL databases and display results as a JSON

Last updated on
2018-07-18
Provides
Syntax
Repository
Source

This extension has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues.

Similar to sqlquery

Tagged with database, json, mysql, query, sql

Description

This plugin processes a SQL query to a MySQL database and inserts the results as a JSON object. The object will be placed in a <script> tag. The name of the variable holding the JSON object can be passed to the script.

The plugin is based on SQL Query Plugin, please donate to George Pirogov if you like it.

Syntax

Basic syntax:

<sqljson [objectname]>[query string]</sqljson>

Examples

If the table “table” looks like this:

id text num
1 f 1665456
2 m 1838972
3 123

JSON is generated like this:

<sqljson test>select * from table;</sqljson>

The generated code will look like this:

<script>
var test = 
[  
   {  
    "id":"1",
    "text":"f",
    "num":"1665456"
   },
   {  
    "id":"2",
    "text":"m",
    "num":"1838972"
   },
   {  
    "id":"3",
    "text":" ",
    "num":"123"
   }
];
</script>

Configuration and Settings

The plugin can be configured via the Configuration Manager

Option Description Default value
Host DNS name or IP address of MySQL server localhost
DB MySQL database name (empty)
user MySQL user name (empty)
password MySQL password (empty)

Change Log

Discussion, feature requests and bugs

http://github.com/MarieMandrela/sqljson/issues