Admin:db

From The Scuba Wiki

Revision as of 00:53, 23 February 2010 by TxHockeyGuy (Talk | contribs)
Jump to: navigation, search
DB Stuff

Note, edit this page to actually be able to see anything. It's gibberish in wiki format.

Categories can easily be searched in the categorylinks table

select * FROM categorylinks WHERE cl_to = 'Test'

Here is the DB structure:

mysql> describe categorylinks;<br>
+--------------+------------------+------+-----+-------------------+-------+
| Field        | Type             | Null | Key | Default           | Extra |
+--------------+------------------+------+-----+-------------------+-------+
| cl_from      | int(10) unsigned | NO   | PRI | 0                 |       |
| cl_to        | varbinary(255)   | NO   | PRI | NULL              |       |
| cl_sortkey   | varbinary(70)    | NO   |     | NULL              |       |
| cl_timestamp | timestamp        | YES  |     | CURRENT_TIMESTAMP |       |
+--------------+------------------+------+-----+-------------------+-------+

Text fields are stored here:

mysql> describe smw_text2;<br>
+------------+-----------------+------+-----+---------+-------+
| Field      | Type            | Null | Key | Default | Extra |
+------------+-----------------+------+-----+---------+-------+
| s_id       | int(8) unsigned | NO   | MUL | NULL    |       |
| p_id       | int(8) unsigned | NO   | MUL | NULL    |       |
| value_blob | mediumblob      | YES  |     | NULL    |       |
+------------+-----------------+------+-----+---------+-------+
3 rows in set (0.00 sec)

SMW makes it's own ID, different than the MW page ID from the page table.

mysql> describe smw_ids;
+---------------+-----------------+------+-----+---------+----------------+
| Field         | Type            | Null | Key | Default | Extra          |
+---------------+-----------------+------+-----+---------+----------------+
| smw_id        | int(8) unsigned | NO   | PRI | NULL    | auto_increment | 
| smw_namespace | int(11)         | NO   |     | NULL    |                | 
| smw_title     | varbinary(255)  | NO   | MUL | NULL    |                | 
| smw_iw        | varchar(32)     | YES  |     | NULL    |                | 
| smw_sortkey   | varbinary(255)  | NO   | MUL | NULL    |                | 
+---------------+-----------------+------+-----+---------+----------------+

Semantic Media Wiki Tables:

| smw_atts2         | 
| smw_conc2         | 
| smw_conccache     | 
| smw_ids           | 
| smw_inst2         | 
| smw_redi2         | 
| smw_rels2         | 
| smw_spec2         | 
| smw_subs2         | 
| smw_text2         |
mysql> describe smw_atts2;
+------------+-----------------+------+-----+---------+-------+
| Field      | Type            | Null | Key | Default | Extra |
+------------+-----------------+------+-----+---------+-------+
| s_id       | int(8) unsigned | NO   | MUL | NULL    |       | 
| p_id       | int(8) unsigned | NO   | MUL | NULL    |       | 
| value_unit | varchar(63)     | YES  |     | NULL    |       | 
| value_xsd  | varbinary(255)  | NO   | MUL | NULL    |       | 
| value_num  | double          | YES  | MUL | NULL    |       | 
+------------+-----------------+------+-----+---------+-------+

Here is where the SMW attributes appear to be.s_id corresponds with the smw_id from the smw_ids table. p_id appears to be a property ID or some such.

s_id - corresponds with the smw_id from the smw_ids table, this can reference a page or other SMW properties p_id - appears to be a property ID, for like depth, temp, etc. value_unit - appears to always be NULL value_xsd - is the primary value, most only utilize this value_num - not quite sure yet

mysql> describe smw_conc2;
+------------------+-----------------+------+-----+---------+-------+
| Field            | Type            | Null | Key | Default | Extra |
+------------------+-----------------+------+-----+---------+-------+
| s_id             | int(8) unsigned | NO   | PRI | NULL    |       | 
| concept_txt      | mediumblob      | YES  |     | NULL    |       | 
| concept_docu     | mediumblob      | YES  |     | NULL    |       | 
| concept_features | int(8)          | YES  |     | NULL    |       | 
| concept_size     | int(8)          | YES  |     | NULL    |       | 
| concept_depth    | int(8)          | YES  |     | NULL    |       | 
| cache_date       | int(8) unsigned | YES  |     | NULL    |       | 
| cache_count      | int(8) unsigned | YES  |     | NULL    |       | 
+------------------+-----------------+------+-----+---------+-------+

This is for SMW concepts, not really used at this time.

mysql> describe smw_conccache;
+-------+-----------------+------+-----+---------+-------+
| Field | Type            | Null | Key | Default | Extra |
+-------+-----------------+------+-----+---------+-------+
| s_id  | int(8) unsigned | NO   |     | NULL    |       | 
| o_id  | int(8) unsigned | NO   | MUL | NULL    |       | 
+-------+-----------------+------+-----+---------+-------+

This table is currently empty.

mysql> describe smw_ids;
+---------------+-----------------+------+-----+---------+----------------+
| Field         | Type            | Null | Key | Default | Extra          |
+---------------+-----------------+------+-----+---------+----------------+
| smw_id        | int(8) unsigned | NO   | PRI | NULL    | auto_increment | 
| smw_namespace | int(11)         | NO   |     | NULL    |                | 
| smw_title     | varbinary(255)  | NO   | MUL | NULL    |                | 
| smw_iw        | varchar(32)     | YES  |     | NULL    |                | 
| smw_sortkey   | varbinary(255)  | NO   | MUL | NULL    |                | 
+---------------+-----------------+------+-----+---------+----------------+

smw_id - This is a unique ID given to many things including pages smw_namespace - This is the name space this page belongs to, currently all are in name space 0 smw_title - This is the title of the page smw_iw - This is set to NULL on all pages, not sure what this is smw_sort_key - This is the title of the page again

mysql> describe smw_inst2;
+-------+-----------------+------+-----+---------+-------+
| Field | Type            | Null | Key | Default | Extra |
+-------+-----------------+------+-----+---------+-------+
| s_id  | int(8) unsigned | NO   | MUL | NULL    |       | 
| o_id  | int(8) unsigned | NO   | MUL | NULL    |       | 
+-------+-----------------+------+-----+---------+-------+

s_id - This is the SMW ID o_id - Not sure what this is

mysql> describe smw_redi2;
+-------------+-----------------+------+-----+---------+-------+
| Field       | Type            | Null | Key | Default | Extra |
+-------------+-----------------+------+-----+---------+-------+
| s_title     | varbinary(255)  | NO   | MUL | NULL    |       | 
| s_namespace | int(11)         | NO   |     | NULL    |       | 
| o_id        | int(8) unsigned | NO   | MUL | NULL    |       | 
+-------------+-----------------+------+-----+---------+-------+

This appears to be some sort of table for storing redirect information for pages, not 100% sure on that though

s_title - SMW page title s_namespace - SMW name space o_id - No idea

mysql> describe smw_rels2;
+-------+-----------------+------+-----+---------+-------+
| Field | Type            | Null | Key | Default | Extra |
+-------+-----------------+------+-----+---------+-------+
| s_id  | int(8) unsigned | NO   | MUL | NULL    |       | 
| p_id  | int(8) unsigned | NO   | MUL | NULL    |       | 
| o_id  | int(8) unsigned | NO   | MUL | NULL    |       | 
+-------+-----------------+------+-----+---------+-------+

Not sure what this is

s_id - SMW id p_id - Property ID? o_id - No idea

mysql> describe smw_spec2;
+--------------+-----------------+------+-----+---------+-------+
| Field        | Type            | Null | Key | Default | Extra |
+--------------+-----------------+------+-----+---------+-------+
| s_id         | int(8) unsigned | NO   | MUL | NULL    |       | 
| p_id         | int(8) unsigned | NO   | MUL | NULL    |       | 
| value_string | varbinary(255)  | NO   |     | NULL    |       | 
+--------------+-----------------+------+-----+---------+-------+

Appears to define allowed values for a given s_id (water type for example).

s_id - SMW id for the SMW variable p_id - Not real sure if this is property id or not now value_string - One of the allowed value strings for that ID

mysql> describe smw_subs2;
+-------+-----------------+------+-----+---------+-------+
| Field | Type            | Null | Key | Default | Extra |
+-------+-----------------+------+-----+---------+-------+
| s_id  | int(8) unsigned | NO   | MUL | NULL    |       | 
| o_id  | int(8) unsigned | NO   | MUL | NULL    |       | 
+-------+-----------------+------+-----+---------+-------+

Not really sure what this is.

mysql> describe smw_subs2;mysql> describe smw_text2;
+------------+-----------------+------+-----+---------+-------+
| Field      | Type            | Null | Key | Default | Extra |
+------------+-----------------+------+-----+---------+-------+
| s_id       | int(8) unsigned | NO   | MUL | NULL    |       | 
| p_id       | int(8) unsigned | NO   | MUL | NULL    |       | 
| value_blob | mediumblob      | YES  |     | NULL    |       | 
+------------+-----------------+------+-----+---------+-------+

This appears to be text based inputs from pages. Comments under EMS section for instance.

s_id - SMW id p_id - property id? value_blob - The text being stored

Personal tools
support the site