Recent Changes - Search:

add Table DB page

hide Table DB

Table DB


hide Topics

Topics

show Changed

Changed

Visitor's book Site map pmwiki-2.3.37

Table DB Usage Manual

The tabledb plugin enables you to manipulate tables in pmwiki.

  • It can read table(s) from any page in the wiki into memory
  • From memory it can display table(s) or table row(s)
  • From memory you can run real database queries

The tabledb syntax:

(:tabledb action=<someaction> alias=<tabblealiasname> page="<group.pagename> table=<tablereference> row=<rownumber>":)

Attributes

  1. action
  2. alias
  3. page
  4. table
  5. row
  6. query

Action Attribute

Can be

  • read - with alias, page, table
  • display - with alias, page, table, row
  • initialize
  • dbver
  • phpver
  • sql

read

reads and appends table(s) into memory. This action requires the page attribute.
Example - read the tables into memory from 2 pages:
(:tabledb action=read page="Main.ReadTable6":)
(:tabledb action=read page="Main.ReadTable7":)
Example - read tables into memory setting an alias for each table name - note that since there are multiple tables the alias will be frog1, frog2, frog3, etc:
(:tabledb action=read alias=frog page="Main.ReadTable7":)
  • For sqlite the header cells become column names - spaces converted to underlines

display

displays table(s) from memory
Example - from memory display the tables that were from a specific page:
(:tabledb action=display page="Main.ReadTable7" :)
Example - from memory display the tables from and alias:
(:tabledb action=display alias=frog3 :)

initialize

clears the memory
(:tabledb action=initialize :)

dbver

display the current sqlite version
(:tabledb action=dbver :)

phpver

display the current PHP version
(:tabledb action=phpver :)

sql

execute sqlite SQL statements on tables that have been read into memory
(:tabledb action=sql query="SELECT * FROM magazines2 WHERE Year BETWEEN 2000 AND 2003 ":)

Alias Attribute

THE ALIAS NAME MUST BE UNIQUE

  • put checks into program to ensure the alias name is unique
  • this works with action=read and also action=display

This attribute is for referencing a particular table in memory or in the sqlite database queries.

The 'read' action can put tables into memory in this form:

  • A single table from an anchor
  • A single table as specified by table number
  • One or more tables read into memory from a page

An alias that is assigned to a single table will use the exact aliasname.

  • aliasname

An alias specified for a single read action which reads multiple tables appends the table number.

  • aliasname1
  • aliasname2
  • aliasname3

Tables can be referenced via the aliasname in the sql queries and in the 'display' action.


Page Attribute

This attribute is currently required when using the 'read' action.

The page name referenced must be of the form GROUPNAME.PAGENAME. You must include the group name, a period, and the pagename. You cannot just have the name of the page without the group name and the period.

Example:

(:tabledb action=read page="Main.ReadTable7":)

Omitting this for the 'display' action will display all the tables from memory.


Table Attribute

The 'table' attribute can be a number or a pmwiki anchor(approve sites). The anchor must have a '#' - as in '#anchorname'.

Table number example:

(:tabledb action=read page="Main.ReadTable7" table="2" :)

Omitting this attribute for the action=display will display all the tables in memory

Table Anchor example:

In the wiki page where the table is located there would be an anchor line in front of the table like this:
[[#apple]]
The the table attribute can then refer to the table using an anchor attribute
(:tabledb action=read page="Main.ReadTable7" table="#apple" :)

Omitting this attribute from the 'read' action will read all the tables on the page.

Specifying a page attribute and omitting this attribute from the 'display' action will display all the tables in memory that came from that page.

Omitting the page attribute and this attribute from the 'display' action will display all the tables in memory.


Row Attribute

The row is the number of a row to display.

(:tabledb action=display page="Main.ReadTable7" table="#apple" row=1 :)

Omitting this attribute will display all the rows.


SQLITE SQL syntax is documented here: http://www.sqlite.org/lang.html(approve sites)


tahi Page last modified on 2016 Jul 26 19:13

Edit - History - Recent Changes - WikiHelp - Search - email page as link -> mailto:?Subject="KiwiWiki: Table DB Usage Manual"&Body=