mysql/core_cities_merge.sql
authorEdward <edward@roojs.com>
Tue, 24 Jun 2014 13:10:31 +0000 (21:10 +0800)
committerEdward <edward@roojs.com>
Tue, 24 Jun 2014 13:10:31 +0000 (21:10 +0800)
mysql/core_cities_merge.sql

index cf287c1..61798e7 100644 (file)
@@ -145,6 +145,7 @@ CREATE FUNCTION core_cities_merge_city()  RETURNS INT DETERMINISTIC
         DECLARE ci_done INT DEFAULT FALSE;
 
         DECLARE v_count INT DEFAULT 0;
+        DECLARE v_total INT DEFAULT 0;
 
         DECLARE v_id INT DEFAULT 0;
         DECLARE v_iso TEXT DEFAULT '';
@@ -169,7 +170,8 @@ CREATE FUNCTION core_cities_merge_city()  RETURNS INT DETERMINISTIC
             meta_location
         WHERE
             type = 'CI';
-        DECLARE CONTINUE HANDLER FOR NOT FOUND SET ci_done = TRUE;
+
+        SELECT COUNT(id) INTO v_total FROM meta_location WHERE type = 'CI';
 
         SET v_count = 0;