Line: 1 to 1 | ||||||||
---|---|---|---|---|---|---|---|---|
Database PluginProvide secure access (read and write) to data in an SQL database, |
Line: 1 to 1 | |||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Added: | |||||||||||||||||||||||||||||||||||||
> > | Database PluginProvide secure access (read and write) to data in an SQL database, with flexible results formatting. Any database that has a DBI interface can be used. This version is for TWiki-4 only.Usage%DATABASE_SQL{description="table_description" sql="sql"}%This is the most general of the commands. It allows you to execute arbitrary SQL statements, and provides flexible formatting of the results.
UPDATE statement) you must not give a format parameter. The format parameter is a string describing the required format for the results, where each $colname will expand to the value of that column. See FormattedSearch for more on how format , header and separator work.
%DATABASE_SQL_TABLE{description="db1" headers="hdr1,hdr2,hdr3" command="sql command"}%
%DATABASE_SQL_REPEAT{description="description" command="..SQL COMMAND.." columns="col1,col2,col3"}% .... user formatting .... %DATABASE_SQL_REPEAT%
%DATABASE_TABLE{description="table_description" headers="hdr1,hdr2,hdr3" columns="col1,col2,col3"}%
%DATABASE_REPEAT{description="table_description" table="mytable" columns="col1,col2,col3"}% .... user formatting .... %DATABASE_REPEAT%
%DATABASE_EDIT{description="table_description" display_text="HTML link text"}%Creates a frame and invokes an external database editor.
Examples%DATABASE_SQL{description="mysql_user_info" format="| $User | $Select_priv |" header="| *User Name* | *Select Privs* |"}%
You will get back a table with one row for each matching database entry.
Using the format functionality, you can define how the database data is displayed wrapping it in any formatting you choose. For example, if you wanted to create a single table cell containing the information for 3 fields of the Kalendus calendar, you could use the following:
%DATABASE_SQL{description="calendar_events" sql="SELECT * from calendar" format="| $startdate $subject $body |"}%
Or let's say you wanted to display the next two upcoming scheduled events in the Kalendus calendar.
%DATABASE_SQL{description="calendar_events" command="SELECT subject,body,startdate FROM kalendus_event WHERE to_days(startdate) > to_days(now()) order by startdate limit 2" format="$startdate<br />$subject<br />$body"}%
<--
Plugin Installation Instructions![]() configure now. You will have to copy the settings from your existing bin/DatabasePluginConfig.pm manually. it should be fairly obvious what you have to do.
You do not need to install anything in the browser to use this extension. The following instructions are for the administrator who installs the extension on the server where TWiki is running.
Like many other TWiki extensions, this module is shipped with a fully
automatic installer script written using the BuildContrib.
Plugin Info
|