[OSM-dev] Semicolon

Joachim Zobel jz-2008 at heute-morgen.de
Sat May 31 08:38:34 BST 2008


Am Freitag, den 16.05.2008, 20:59 +0200 schrieb Martijn van Oosterhout:
> >> I agree that it should be moved out personally - any volunteers to
> >> do the job?
> >
> > Me, if this is still an issue.
> 
> Been done AIUI. Will be deployed at some time...

Shure? I did not find anything in

http://trac.openstreetmap.org/browser/sites/rails_port/db/migrate

Sinerely,
Joachim


CREATE TABLE enumeration (
  cnt SMALLINT PRIMARY KEY AUTO_INCREMENT
);

-- Repeat often enough
INSERT INTO enumeration VALUES(NULL);

SELECT id, cnt, 
    -- There is no checking for more than 1 = yet
       SUBSTRING_INDEX(tag, '=', 1) AS k, 
       SUBSTRING_INDEX(tag, '=', -1) AS v 
  FROM (
SELECT n.id, en.cnt, 
    -- The ;;; escaping is not handled
       SUBSTRING_INDEX( 
            SUBSTRING_INDEX(tags, ';', en.cnt), ';', -1) AS tag 
  FROM current_nodes n
  JOIN enumeration
    -- There is no better way to compute the number of ; in MySQL
    ON en.cnt <= LENGTH(n.tags) - LENGTH(REPLACE(n.tags, ';', '')) + 1
) t

-- This is not thought to be permanent
DROP TABLE enumeration;






More information about the dev mailing list