#! /bin/bash #R. Stiening June 14, 2006 #Select count_images(ra,decl,s_type,f_type,cat) RETURNS number of images psql -ec "CREATE OR REPLACE FUNCTION count_images(float,float,char(3),char(1),char(1)) RETURNS integer AS 'SELECT count(*)::integer as xxx FROM images WHERE cat=lower(\$5) AND f_type=upper(\$4) AND s_type=lower(\$3) AND decl BETWEEN \$2 - 0.1423 AND \$2 + 0.1423 AND distance(ra,\$2,\$1,\$2) < 256.0 ' LANGUAGE SQL IMMUTABLE RETURNS NULL ON NULL INPUT; " wsdb #Select count_images(ra,decl,s_type,f_type) RETURNS number of images psql -ec "CREATE OR REPLACE FUNCTION count_images(float,float,char(3),char(1)) RETURNS integer AS 'SELECT count(*)::integer as xxx FROM images WHERE f_type=upper(\$4) AND s_type=lower(\$3) AND decl BETWEEN \$2 - 0.1423 AND \$2 + 0.1423 AND distance(ra,\$2,\$1,\$2) < 256.0 ' LANGUAGE SQL IMMUTABLE RETURNS NULL ON NULL INPUT; " wsdb