| Vendor | MindTouch |
| Type | Native |
| Categories | Database |
| Requires | MindTouch 1.8.2 or later |
| OS Restriction | None |
| Status | Stable |
| License | Free/Open Source |
| SID (service id) | sid://mindtouch.com/2007/06/mysql |
| Assembly | mindtouch.deki.services |
Install Extension
Table of Contents
This extension contains functions for displaying data from MySQL databases.
See also How to add an extension, Using the Extension Dialog, Learn about DekiScript, Extensions Directory.
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. The catalog is also referred to database at times. The catalog contains the tables. |
| 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) |
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) |
Collect all columns from a SELECT query. (New in 8.05)
Parameters:
| Name | Type | Description |
| query | str | SELECT query. |
Collect all columns and all rows from a SELECT query. (New in 8.05)
Parameters:
| Name | Type | Description |
| query | str | SELECT query. |
Copyright © 2011 MindTouch, Inc. Powered by
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
"db-catalog Config Key" = What is this supposed to be? MySql has its server name, which contains one or more databases within it, each of which contains one or more tables. So what's a catalog?
"Preference = namespace" = are you trying to associate a particular database within a MySql server here?
An example or two of connection parameters would also be helpful.
function | spec | manifest
-------------------------------------
Value | xml | str
List | xml | list
CAST(columnName AS CHAR(10) CHARACTER SET utf8)
My query return more than one row, actually hundreds, but finally the List or Map are eather populated by one record.
Here below a snip of my code. Any help is appreciated.
var sqlQuery = "select
date(radpostauth.authdate) as Anno,
count(username) as Autenticazioni
FROM radpostauth
where reply='Access-Accept'
group by Anno
order by Anno desc";
var recordList = [ radsql.RecordList(sqlQuery) ];
var recordListLenght = #recordList;
<div>"RecordListLenght :"..recordListLenght</div>
var recordMap = { query: radsql.Record(sqlQuery) };
var recordMapLenght = #recordMap;
<div>"RecordMapLenght :"..recordMapLenght</div>
both RecordMapLenght and RecordListLenght are equal to 1!
I'm going crazy about that.
Please heeelp!! :-)
<p><script type="text/javascript">/*<![CDATA[*/
var city;
function insert()
{
city = document.getElementById('txtCity').value;
alert(city);
document.getElementById('record').style.visibility = 'visible';
}
/*]]>*/</script></p>
<p><input id="txtCity" name="txtCity" type="text" /></p>
<div id="record" style="visibility:hidden">
{{mysql.table("INSERT into user_info values (??,'','','','','','','','','')")}}
</div>
<p><input ctor="when($this.click) insert()" type="submit" value="Submit" /></p>