User:Topbanana/Reports/Scripts/extract nowiki.sql
This user subpage is currently inactive and is retained for historical reference. If you want to revive discussion regarding the subject, you might try contacting the user in question or seeking broader input via a forum such as the village pump. |
This page describes a subscript used in the creation of a link analysis database.
You'll need to generate the whole thing yourself, it's too large to sensibly store here. 400 repeats definately catches all links as of June 2004.
INSERT INTO special_text ( special_id, art_id, pos, start ) SELECT 0, art.art_id, s2.pos+1, locate( '<nowiki>', art_text, start ) + 8 FROM special_text s2 JOIN art on s2.art_id = art.art_id WHERE s2.special_id = 0 AND locate( '<nowiki>', art_text, start ) > 0 AND s2.pos = 1; INSERT INTO special_text ( special_id, art_id, pos, start ) SELECT 0, art.art_id, s2.pos+1, locate( '<nowiki>', art_text, start ) + 8 FROM special_text s2 JOIN art on s2.art_id = art.art_id WHERE s2.special_id = 0 AND locate( '<nowiki>', art_text, start ) > 0 AND s2.pos = 2; INSERT INTO special_text ( special_id, art_id, pos, start ) SELECT 0, art.art_id, s2.pos+1, locate( '<nowiki>', art_text, start ) + 8 FROM special_text s2 JOIN art on s2.art_id = art.art_id WHERE s2.special_id = 0 AND locate( '<nowiki>', art_text, start ) > 0 AND s2.pos = 3; INSERT INTO special_text ( special_id, art_id, pos, start ) SELECT 0, art.art_id, s2.pos+1, locate( '<nowiki>', art_text, start ) + 8 FROM special_text s2 JOIN art on s2.art_id = art.art_id WHERE s2.special_id = 0 AND locate( '<nowiki>', art_text, start ) > 0 AND s2.pos = 4; INSERT INTO special_text ( special_id, art_id, pos, start ) SELECT 0, art.art_id, s2.pos+1, locate( '<nowiki>', art_text, start ) + 8 FROM special_text s2 JOIN art on s2.art_id = art.art_id WHERE s2.special_id = 0 AND locate( '<nowiki>', art_text, start ) > 0 AND s2.pos = 5;
... and repeat as necessary, increasing 'pos' each time.