From: Scott C. <sco...@us...> - 2006-01-06 19:24:59
|
Update of /cvsroot/gmod/schema/chado/modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30683/modules Modified Files: default_schema.sql Log Message: removed double $ quoting--it isn't supported by Pg7.4 Index: default_schema.sql =================================================================== RCS file: /cvsroot/gmod/schema/chado/modules/default_schema.sql,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** default_schema.sql 29 Dec 2005 18:30:02 -0000 1.37 --- default_schema.sql 6 Jan 2006 19:24:47 -0000 1.38 *************** *** 876,901 **** CREATE OR REPLACE FUNCTION get_organism_id(VARCHAR,VARCHAR) RETURNS INT ! AS $$ SELECT organism_id FROM organism WHERE genus=$1 AND species=$2 ! $$ LANGUAGE 'sql'; CREATE OR REPLACE FUNCTION get_organism_id(VARCHAR) RETURNS INT ! AS $$ SELECT organism_id FROM organism ! WHERE genus=substring($1,1,position(' ' IN $1)-1) ! AND species=substring($1,position(' ' IN $1)+1) ! $$ LANGUAGE 'sql'; CREATE OR REPLACE FUNCTION get_organism_id_abbrev(VARCHAR) RETURNS INT ! AS $$ SELECT organism_id FROM organism WHERE substr(genus,1,1)=substring($1,1,1) ! AND species=substring($1,position(' ' IN $1)+1) ! $$ LANGUAGE 'sql'; CREATE OR REPLACE FUNCTION store_organism (VARCHAR,VARCHAR,VARCHAR) --- 876,901 ---- CREATE OR REPLACE FUNCTION get_organism_id(VARCHAR,VARCHAR) RETURNS INT ! AS ' SELECT organism_id FROM organism WHERE genus=$1 AND species=$2 ! ' LANGUAGE 'sql'; CREATE OR REPLACE FUNCTION get_organism_id(VARCHAR) RETURNS INT ! AS ' SELECT organism_id FROM organism ! WHERE genus=substring($1,1,position('' '' IN $1)-1) ! AND species=substring($1,position('' '' IN $1)+1) ! ' LANGUAGE 'sql'; CREATE OR REPLACE FUNCTION get_organism_id_abbrev(VARCHAR) RETURNS INT ! AS ' SELECT organism_id FROM organism WHERE substr(genus,1,1)=substring($1,1,1) ! AND species=substring($1,position('' '' IN $1)+1) ! ' LANGUAGE 'sql'; CREATE OR REPLACE FUNCTION store_organism (VARCHAR,VARCHAR,VARCHAR) *************** *** 1752,1756 **** CREATE OR REPLACE FUNCTION project_featureloc_up(int,int) RETURNS featureloc AS ! $$ DECLARE in_featureloc_id alias for $1; --- 1752,1756 ---- CREATE OR REPLACE FUNCTION project_featureloc_up(int,int) RETURNS featureloc AS ! ' DECLARE in_featureloc_id alias for $1; *************** *** 1801,1809 **** RETURN in_featureloc; END ! $$ LANGUAGE 'plpgsql'; CREATE OR REPLACE FUNCTION project_point_g2t(int,int,int) ! RETURNS INT AS $$ DECLARE in_p alias for $1; --- 1801,1809 ---- RETURN in_featureloc; END ! ' LANGUAGE 'plpgsql'; CREATE OR REPLACE FUNCTION project_point_g2t(int,int,int) ! RETURNS INT AS ' DECLARE in_p alias for $1; *************** *** 1814,1818 **** exon_cvterm_id INT; BEGIN ! SELECT INTO exon_cvterm_id get_feature_type_id('exon'); SELECT INTO out_p CASE --- 1814,1818 ---- exon_cvterm_id INT; BEGIN ! SELECT INTO exon_cvterm_id get_feature_type_id(''exon''); SELECT INTO out_p CASE *************** *** 1831,1869 **** RETURN in_featureloc; END ! $$ LANGUAGE 'plpgsql'; CREATE OR REPLACE FUNCTION get_cv_id_for_feature() RETURNS INT ! AS $$SELECT cv_id FROM cv WHERE name='sequence'$$ LANGUAGE 'sql'; CREATE OR REPLACE FUNCTION get_cv_id_for_featureprop() RETURNS INT ! AS $$SELECT cv_id FROM cv WHERE name='feature_property'$$ LANGUAGE 'sql'; CREATE OR REPLACE FUNCTION get_cv_id_for_feature_relationsgip() RETURNS INT ! AS $$SELECT cv_id FROM cv WHERE name='relationship'$$ LANGUAGE 'sql'; CREATE OR REPLACE FUNCTION get_feature_type_id(VARCHAR) RETURNS INT ! AS $$ SELECT cvterm_id FROM cv INNER JOIN cvterm USING (cv_id) ! WHERE cvterm.name=$1 AND cv.name='sequence' ! $$ LANGUAGE 'sql'; CREATE OR REPLACE FUNCTION get_featureprop_type_id(VARCHAR) RETURNS INT ! AS $$ SELECT cvterm_id FROM cv INNER JOIN cvterm USING (cv_id) ! WHERE cvterm.name=$1 AND cv.name='feature_property' ! $$ LANGUAGE 'sql'; CREATE OR REPLACE FUNCTION get_feature_relationship_type_id(VARCHAR) RETURNS INT ! AS $$ SELECT cvterm_id FROM cv INNER JOIN cvterm USING (cv_id) ! WHERE cvterm.name=$1 AND cv.name='relationship' ! $$ LANGUAGE 'sql'; -- depends on sequence-cv-helper CREATE OR REPLACE FUNCTION get_feature_id(VARCHAR,VARCHAR,VARCHAR) RETURNS INT ! AS $$ SELECT feature_id FROM feature --- 1831,1869 ---- RETURN in_featureloc; END ! ' LANGUAGE 'plpgsql'; CREATE OR REPLACE FUNCTION get_cv_id_for_feature() RETURNS INT ! AS 'SELECT cv_id FROM cv WHERE name=''sequence''' LANGUAGE 'sql'; CREATE OR REPLACE FUNCTION get_cv_id_for_featureprop() RETURNS INT ! AS 'SELECT cv_id FROM cv WHERE name=''feature_property''' LANGUAGE 'sql'; CREATE OR REPLACE FUNCTION get_cv_id_for_feature_relationsgip() RETURNS INT ! AS 'SELECT cv_id FROM cv WHERE name=''relationship''' LANGUAGE 'sql'; CREATE OR REPLACE FUNCTION get_feature_type_id(VARCHAR) RETURNS INT ! AS ' SELECT cvterm_id FROM cv INNER JOIN cvterm USING (cv_id) ! WHERE cvterm.name=$1 AND cv.name=''sequence'' ! ' LANGUAGE 'sql'; CREATE OR REPLACE FUNCTION get_featureprop_type_id(VARCHAR) RETURNS INT ! AS ' SELECT cvterm_id FROM cv INNER JOIN cvterm USING (cv_id) ! WHERE cvterm.name=$1 AND cv.name=''feature_property'' ! ' LANGUAGE 'sql'; CREATE OR REPLACE FUNCTION get_feature_relationship_type_id(VARCHAR) RETURNS INT ! AS ' SELECT cvterm_id FROM cv INNER JOIN cvterm USING (cv_id) ! WHERE cvterm.name=$1 AND cv.name=''relationship'' ! ' LANGUAGE 'sql'; -- depends on sequence-cv-helper CREATE OR REPLACE FUNCTION get_feature_id(VARCHAR,VARCHAR,VARCHAR) RETURNS INT ! AS ' SELECT feature_id FROM feature *************** *** 1871,1875 **** AND type_id=get_feature_type_id($2) AND organism_id=get_organism_id($3) ! $$ LANGUAGE 'sql'; CREATE OR REPLACE FUNCTION store_feature (INT,INT,INT,INT, --- 1871,1875 ---- AND type_id=get_feature_type_id($2) AND organism_id=get_organism_id($3) ! ' LANGUAGE 'sql'; CREATE OR REPLACE FUNCTION store_feature (INT,INT,INT,INT, *************** *** 2046,2050 **** CREATE OR REPLACE FUNCTION subsequence_by_subfeatures(INT,INT,INT,INT) ! RETURNS TEXT AS $$ DECLARE v_feature_id ALIAS FOR $1; DECLARE v_rtype_id ALIAS FOR $2; --- 2046,2050 ---- CREATE OR REPLACE FUNCTION subsequence_by_subfeatures(INT,INT,INT,INT) ! RETURNS TEXT AS ' DECLARE v_feature_id ALIAS FOR $1; DECLARE v_rtype_id ALIAS FOR $2; *************** *** 2054,2058 **** DECLARE seqrow RECORD; BEGIN ! subseq = ''; FOR seqrow IN SELECT --- 2054,2058 ---- DECLARE seqrow RECORD; BEGIN ! subseq = ''''; FOR seqrow IN SELECT *************** *** 2076,2080 **** RETURN subseq; END ! $$ LANGUAGE 'plpgsql'; --- 2076,2080 ---- RETURN subseq; END ! ' LANGUAGE 'plpgsql'; *************** *** 2086,2092 **** CREATE OR REPLACE FUNCTION subsequence_by_subfeatures(INT) RETURNS TEXT AS ! $$ ! SELECT subsequence_by_subfeatures($1,get_feature_relationship_type_id('part_of'),0,0) ! $$ LANGUAGE 'sql'; --- 2086,2092 ---- CREATE OR REPLACE FUNCTION subsequence_by_subfeatures(INT) RETURNS TEXT AS ! ' ! SELECT subsequence_by_subfeatures($1,get_feature_relationship_type_id(''part_of''),0,0) ! ' LANGUAGE 'sql'; *************** *** 2094,2098 **** -- constrained by subfeature.type_id (eg exons of a transcript) CREATE OR REPLACE FUNCTION subsequence_by_typed_subfeatures(INT,INT,INT,INT) ! RETURNS TEXT AS $$ DECLARE v_feature_id ALIAS FOR $1; DECLARE v_ftype_id ALIAS FOR $2; --- 2094,2098 ---- -- constrained by subfeature.type_id (eg exons of a transcript) CREATE OR REPLACE FUNCTION subsequence_by_typed_subfeatures(INT,INT,INT,INT) ! RETURNS TEXT AS ' DECLARE v_feature_id ALIAS FOR $1; DECLARE v_ftype_id ALIAS FOR $2; *************** *** 2102,2106 **** DECLARE seqrow RECORD; BEGIN ! subseq = ''; FOR seqrow IN SELECT --- 2102,2106 ---- DECLARE seqrow RECORD; BEGIN ! subseq = ''''; FOR seqrow IN SELECT *************** *** 2124,2128 **** RETURN subseq; END ! $$ LANGUAGE 'plpgsql'; --- 2124,2128 ---- RETURN subseq; END ! ' LANGUAGE 'plpgsql'; |