This extension contains functions for displaying data from MySQL databases. Related Links: Extension Overview, DekiScript Overview, Extension Demos.
Assembly: mindtouch.deki.services
SID: sid://mindtouch.com/2007/06/mysql
This service requires Deki Wiki 1.8.2 or later.
To enable this extension, follow these steps:
Configuration:
Before the MySql service can be used, it must be configured with the access information to the database.
| Config Key | Description |
| db-server | IP/hostname of the MySql server |
| db-port | Optional. MySql server port (default: 3306) |
| db-catalog | Database catalog name |
| db-user | User name (IMPORTANT: make sure user has read-only access!) |
| db-password | Password for user |
| db-options | Optional. Custom options string that is passed in when connecting to the database |
If you need to configure multiple databases for the same wiki, register this extension once for each database. Use the following preference to specify a unique namespace value for each registration. Invoke the service using this value instead of mysql. For example, if you set namespace=mydb1, you would invoke the service with mydb1.table("...") instead of mysql.table("...").
| Preference | Description |
| namespace | Specifies a custom namespace (default: mysql) |
Functions:
Show results of a SELECT query in a sortable table.
Parameters:
| Name | Type | Description |
| query | str | SELECT query. |
Samples:
| Output | ||
|
Show single value from a SELECT query. (New in 1.8.3)
Parameters:
| Name | Type | Description |
| query | str | SELECT query. |
Collect rows as a list from a SELECT query. (New in 1.8.3)
Parameters:
| Name | Type | Description |
| query | str | SELECT query. |
| column | str | Optional. Column name (default: first column) |
I would like to have a dynmic table on a wiki page to which data can be added and deleted.
db-options Optional. Custom options string that is passed in when connecting to the database
pooling=true; Connection Timeout=5; Protocol=socket; Min Pool Size=2; Max Pool Size=50; Connection Reset=false;character set=utf8
It would be great to allow the user to add data to mysql directly on the wiki page.
"how difficult would it be to add a function that would push data entered into a form into the mysql database
I would like to have a dynmic table on a wiki page to which data can be added and deleted."
That would be a great feature.
I wanted to transform the ID-field to a link that would point to our issue tracker, I did a really fancy MySQL query for it and when I tested it in mysql client, it worked perfectly. However when I tried it in this extension, the link part only returned the text "System.Byte[]". It did fetch all the rows correctly and render the table, but the ID part was not working for some reason. Any idea what might cause that?
The query I was using was similar to this: (yes, I did escape the double quotes when I put it inside mysql.Table())
SELECT CONCAT_WS('', '<a href="http://url.to.issue.tracker/issue/', issue_id, '">', issue_id, '</a>') AS `ID`, issue_title AS `Title` FROM issues WHERE project = 1337