User:Dantman/GE Extended/Custom Extensions/DataTables

The DataTable  extension allows special table like structures to be added via a specialpage, and returned using a parserfunction. Things such as Episode list tables can be added to the wiki, and a parserfunction can be used in templates to output the data. The parserfunction's code is and it accepts a number of paramaters in a similar way to the new DPL code.

The system works using 4 database tables. One for table types, one for tables, one for columns, and one for values. The columns table holds information such as the names and id's of various columns. Each of these columns references a table type which it belongs to. The table types table holds information about the different table types such as their names and keys. The tables database table holds the basic information on a table, such as it's name and key, and also any protection level. The tables table also holds information on what table type the table uses which is what is used to determine what columns are part of the table. And finally the values tables holds the information on each individual value. Each item holds information on the value, the table it belongs to, and the column it belongs to. These values also hold information on if they are deleted or not (To allow undeletion; Since this will be publicly editable, and publicly deletable)

Examples
For a table with the key nanoha-ep (Which would be a episode list for the Nanoha GE World) where the episode list table type has the columns ep/title/english/kanji/romanji/airdate this would output the title for ep 5. For that same table, this would pass the ep/title/english/kanji/romanji parameters to the template (of course that template might never exist...) And for that same table again, this time this code could be used inside of a WikiTable if you had a template which tool the no, title, english, kanji, romanji, and airdate parameters and used them to create a row for the episodes. This would then end up creating an entire episode lists page from the database instead of doing it by hand.

SQL Setup
CREATE TABLE `etDTTypes` (	`tid` mediumint NOT NULL AUTO_INCREMENT PRIMARY KEY,	`key` varchar(64) NOT NULL,	`name` varchar(255) NOT NULL,	`info` TEXT NOT NULL,	`protection` ENUM('none','semi','full') NOT NULL,	`data_state` ENUM('viewable','deleted','oversighted') NOT NULL ) ENGINE = MYISAM ; CREATE TABLE `etDTColumns` (	`cid` mediumint NOT NULL AUTO_INCREMENT PRIMARY KEY,	`tid` mediumint NOT NULL,	`key` varchar(64) NOT NULL,	`name` varchar(255) NOT NULL,	`data_format` TEXT NOT NULL,	`data_default` TEXT NOT NULL,	`display` BOOL NOT NULL,	`sortable` BOOL NOT NULL,	`large_field` BOOL NOT NULL,	`order_id` int NOT NULL,	`data_state` ENUM('viewable','deleted','oversighted') NOT NULL ) ENGINE = MYISAM ; CREATE TABLE `etDTTables` (	`did` mediumint NOT NULL AUTO_INCREMENT PRIMARY KEY,	`tid` mediumint NOT NULL,	`key` varchar(64) NOT NULL,	`name` varchar(255) NOT NULL,	`info` TEXT NOT NULL,	`protection` ENUM('none','semi','full') NOT NULL,	`data_state` ENUM('viewable','deleted','oversighted') NOT NULL ) ENGINE = MYISAM ; CREATE TABLE `etDTValues` (	`vid` mediumint NOT NULL AUTO_INCREMENT PRIMARY KEY,	`did` mediumint NOT NULL,	`cid` mediumint NOT NULL,	`rid` mediumint NOT NULL,	`val` TEXT NOT NULL,	`data_state` ENUM('viewable','deleted','oversighted') NOT NULL ) ENGINE = MYISAM ;