Jump to content

User:Topbanana/Reports/Scripts/extract math.sql

From Wikipedia, the free encyclopedia

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


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