User:Topbanana/Reports/Scripts/extract HTML comment.sql

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 2, art.art_id, s2.pos+1, locate( '&lt;!--', art_text, start ) + 4 FROM special_text s2 JOIN art on s2.art_id = art.art_id WHERE s2.special_id = 2 AND locate( '&lt;!--', art_text, start ) > 0 AND s2.pos = 1; INSERT INTO special_text ( special_id, art_id, pos, start ) SELECT 2, art.art_id, s2.pos+1, locate( '&lt;!--', art_text, start ) + 4 FROM special_text s2 JOIN art on s2.art_id = art.art_id WHERE s2.special_id = 2 AND locate( '&lt;!--', art_text, start ) > 0 AND s2.pos = 2; INSERT INTO special_text ( special_id, art_id, pos, start ) SELECT 2, art.art_id, s2.pos+1, locate( '&lt;!--', art_text, start ) + 4 FROM special_text s2 JOIN art on s2.art_id = art.art_id WHERE s2.special_id = 2 AND locate( '&lt;!--', art_text, start ) > 0 AND s2.pos = 3; INSERT INTO special_text ( special_id, art_id, pos, start ) SELECT 2, art.art_id, s2.pos+1, locate( '&lt;!--', art_text, start ) + 4 FROM special_text s2 JOIN art on s2.art_id = art.art_id WHERE s2.special_id = 2 AND locate( '&lt;!--', art_text, start ) > 0 AND s2.pos = 4; INSERT INTO special_text ( special_id, art_id, pos, start ) SELECT 2, art.art_id, s2.pos+1, locate( '&lt;!--', art_text, start ) + 4 FROM special_text s2 JOIN art on s2.art_id = art.art_id WHERE s2.special_id = 2 AND locate( '&lt;!--', art_text, start ) > 0 AND s2.pos = 5;

... and repeat as necessary, increasing 'pos' each time.