Actions

Database

Main Page

From PubNight

This is the page page for Steves "Database in a Wiki" project.

What's the Idea

Well basically its to allow simple databases to be implemented inside as Wiki. I'm not talking about something as big as Oracle or MySQL but rather the ability to create pages containing reference data and query that data back into other pages in the wiki.

So it's like the PNPD pages?

Sort of - but more flexable. A lot of the PNC Data fields are hard coded in a 30K PHP file. The Breweries page was what prompted Nick to suggest building the new database thing.

What's the Plan

Starting of simple of course.

The first objective is to get the system to be able to query from a single table with basic logic (and, or, not etc) using multiple fields.

"Table" structure

  • Each table will be its own Wikipage - it will look horrible (unless I use the nowiki tags) but will look fine when its being edited.
  • Each table will have its fields specified on the first line
  • Table fields can be separated by custom separators e.g. comma, pipe, colon etc. (This defaults to comma)
  • Table fields can't contain line feeds as that is the record separator (This defaults to CR but can be changed)

Querying the data

Inside the opening tag things like the field separator (and record delimiter?) will be specified. Between the open and close tags will be the query itself.

So for example: <dbquery separator=: delimiter=| format=table>Select name,local from people where town=Cheltenham </dbquery>

This query will be my first "target"

Future enhancements

  • Column aliases - e.g. Select local as Pub Name
  • Nested logic - e.g. where (name="Paul" or name="Richard") and town="Cheltenham"
  • Field ordering - allowing you to specify which fields to sort on and what order they should be sorted in
  • Statistical style functions such as Count, Max, Min etc.