pastebin - collaborative debugging

pastebin is a collaborative debugging tool allowing you to share and modify code snippets while chatting on IRC, IM or a message board.

This site is developed to XHTML and CSS2 W3C standards. If you see this paragraph, your browser does not support those standards and you need to upgrade. Visit WaSP for a variety of options.

yancho private pastebin - collaborative debugging tool What's a private pastebin?


Posted by Yancho on Sat 26 Jan 11:15
report abuse | download | new post

  1. -- Function: give_target(text, integer, integer)
  2.  
  3. -- DROP FUNCTION give_target(text, integer, integer);
  4.  
  5. CREATE OR REPLACE FUNCTION give_target(text, integer, integer)
  6.   RETURNS integer AS
  7. $BODY$
  8.  
  9. DECLARE
  10.         pojnt ALIAS FOR $1;
  11.         box ALIAS FOR $2;
  12.         dist ALIAS FOR $3;
  13.  
  14.         r_target INTEGER;
  15.  
  16. BEGIN
  17.         SELECT target INTO r_target
  18.         FROM streets s
  19.         WHERE
  20.                 (
  21.                 the_geom && expand (pointfromtext(pojnt),box) AND
  22.                 distance (s.the_geom , pointfromtext(pojnt)) < dist
  23.                 )
  24.         ORDER BY distance (s.the_geom , pointfromtext(pojnt)) ASC
  25.         LIMIT 1;
  26.  
  27.         RETURN r_target;
  28. END;
  29. $BODY$
  30.   LANGUAGE 'plpgsql' VOLATILE;
  31. ALTER FUNCTION give_target(text, integer, integer) OWNER TO yancho;

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with @@


Remember me so that I can delete my post