anchor.diff:  
   USE hutmap;
   
  -DROP FUNCTION IF EXISTS `distance`
  +DROP FUNCTION IF EXISTS `distance`;
   
   -- Switch delimiter so the ; will work in the function body
   DELIMITER $$
  
positive.code:   DETERMINISTIC 
    COMMENT 'Calculate the distance between two points' 
    BEGIN 
      RETURN glength(linestringFromwkb(linestring(geomfromtext(astext(a)),geomfromtext(astext(b)))));
    END$$
  
  -- Switch the delimiter back to ;
  
negative.code:   DETERMINISTIC 
    COMMENT 'Calculate the distance between two points' 
    BEGIN 
      RETURN 6371 * 2 * ASIN(SQRT(POWER(SIN(RADIANS(ABS(X(a)) - ABS(X(b)))), 2) + COS(RADIANS(ABS(X(a)))) * COS(RADIANS(ABS(X(b)))) * POWER(SIN(RADIANS(Y(a) - Y(b))), 2)));
    END$$
  
  -- Switch the delimiter back to ;
  