MediaWiki/tables: Difference between revisions
from HTYP, the free directory anyone can edit if they can prove to me that they're not a spambot
should work |
slightly more useful query |
||
| Line 4: | Line 4: | ||
Names and values are kept in binary blobs, though (even though they are strings), so you have to do a modified query to see what's going on: | Names and values are kept in binary blobs, though (even though they are strings), so you have to do a modified query to see what's going on: | ||
<syntaxhighlight lang=mysql>SELECT pp_page, CAST(pp_propname AS CHAR) AS Name, CAST(pp_value AS CHAR) AS Value, pp_sortkey FROM page_props;</syntaxhighlight> | <syntaxhighlight lang=mysql>SELECT pp_page, CAST(pp_propname AS CHAR) AS Name, CAST(pp_value AS CHAR) AS Value, pp_sortkey FROM page_props;</syntaxhighlight> | ||
A slightly more complex query to show the names of the pages (instead of just IDs): | |||
<syntaxhighlight lang=mysql>SELECT | |||
pp_page, | |||
page_namespace, | |||
page_title, | |||
CAST(pp_propname AS CHAR) AS Name, | |||
CAST(pp_value AS CHAR) AS Value, | |||
pp_sortkey | |||
FROM | |||
page_props | |||
LEFT JOIN | |||
page ON pp_page = page_id | |||
</syntaxhighlight> | |||
Revision as of 01:29, 15 December 2017
page_props
Stores "page properties". I'm not quite sure how this is supposed to be used, as it always seems to be empty until I start mucking around with it.
Names and values are kept in binary blobs, though (even though they are strings), so you have to do a modified query to see what's going on:
SELECT pp_page, CAST(pp_propname AS CHAR) AS Name, CAST(pp_value AS CHAR) AS Value, pp_sortkey FROM page_props;
A slightly more complex query to show the names of the pages (instead of just IDs):
SELECT
pp_page,
page_namespace,
page_title,
CAST(pp_propname AS CHAR) AS Name,
CAST(pp_value AS CHAR) AS Value,
pp_sortkey
FROM
page_props
LEFT JOIN
page ON pp_page = page_id
