Datacube support
Summary:
This mechanism allows Dæghrefn to be configured to fill data to
MySQL tables from the partyline.
In the partyline, the user writes .+db <name of the datacube>.
It receives instruction to fill a form as a dialog.
For example, for a song database, the dialog could be:
<luser> .+db songs <robot> Song artist: <luser> Apocalyptica <robot> Song title: <luser> In the Hall of the Mountain King <robot> Song comment: <luser> This is a metal interpretation, with cello. <luser> The original title is from 1875, as 'incidental music'. <luser> + <robot> Ajouté dans le cube :-)
Dictionary structure
The datacube properties is a dictionary with the following data structure:
key | type | description |
db | string | The database where the table is located |
table | string | The table where to insert data into |
fields | list | The fields (ie the columns) to use in the INSERT query |
fields_types | list | For each field, "line" for varchar, etc. / "multiline" for text |
fields_prompts | list | For each field, the label to prompt the user to invite them to fill a value |
In the dialog example above, the values could be:
key | value |
db | radio |
table | songs |
fields | {artist title comment} |
fields_types | {line line multline} |
fields_prompts | {"Song artist:" "Song title:" "Song comment:"} |
Such datastructure would be saved in db_datacubes table,
with "songs" as title and the dictionary TCL string as
properties value.
Test Plan: Tested on Dæghrefn with a lyrics table
Reviewers: dereckson
Reviewed By: dereckson
Differential Revision: https://devcentral.nasqueron.org/D1394