Changeset e94863c5d22e2229730530ce3039661489cbbd73

Show
Ignore:
Timestamp:
07/10/08 18:34:28 (6 years ago)
Author:
Theo Schlossnagle <jesus@omniti.com>
git-committer:
Theo Schlossnagle <jesus@omniti.com> 1215714868 +0000
git-parent:

[adba02c5fdb37a1095d0d170a8cf31937dbedbb0]

git-author:
Theo Schlossnagle <jesus@omniti.com> 1215714868 +0000
Message:

make the fetch_ procedures also accept sids

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • sql/schema.sql

    radba02c re94863c  
    926926 
    927927 
    928 create or replace function 
    929 stratcon.fetch_varset(in_check uuid, 
    930                        in_name text, 
    931                        in_start_time timestamptz, 
    932                        in_end_time timestamptz, 
    933                        in_hopeful_nperiods int) 
    934 returns setof stratcon.loading_dock_metric_text_s_change_log as 
    935 $$ 
     928CREATE OR REPLACE FUNCTION stratcon.fetch_varset(in_check uuid, in_name text, in_start_time timestamp with time zone, in_end_time timestamp with time zone, in_hopeful_nperiods integer) 
     929  RETURNS SETOF stratcon.loading_dock_metric_text_s_change_log AS 
     930$BODY$ 
     931declare 
     932  v_sid int; 
     933begin 
     934  -- Map out uuid to an sid. 
     935  select sid into v_sid from stratcon.map_uuid_to_sid where id = in_check; 
     936  if not found then 
     937    return; 
     938  end if; 
     939 
     940  return query select * from stratcon.fetch_varset(v_sid::integer, in_name, in_start_time, in_end_time, in_hopeful_nperiods); 
     941end 
     942$BODY$ 
     943  LANGUAGE 'plpgsql' VOLATILE 
     944  COST 100 
     945  ROWS 1000; 
     946ALTER FUNCTION stratcon.fetch_varset(uuid, text, timestamp with time zone, timestamp with time zone, integer) OWNER TO omniti; 
     947 
     948CREATE OR REPLACE FUNCTION stratcon.fetch_varset(in_sid integer, in_name text, in_start_time timestamp with time zone, in_end_time timestamp with time zone, in_hopeful_nperiods integer) 
     949  RETURNS SETOF stratcon.loading_dock_metric_text_s_change_log AS 
     950$BODY$ 
    936951declare 
    937952  v_sid int; 
     
    944959begin 
    945960  -- Map out uuid to an sid. 
    946   select sid into v_sid from stratcon.map_uuid_to_sid where id = in_check; 
    947   if not found then 
    948     return; 
    949   end if; 
     961  v_sid := in_sid; 
    950962 
    951963  select * into v_target from stratcon.choose_window(in_start_time, in_end_time, in_hopeful_nperiods); 
     
    10151027  return; 
    10161028end 
    1017 $$ language 'plpgsql'; 
    1018  
     1029$BODY$ 
     1030  LANGUAGE 'plpgsql' VOLATILE 
     1031  COST 100 
     1032  ROWS 1000; 
     1033ALTER FUNCTION stratcon.fetch_varset(integer, text, timestamp with time zone, timestamp with time zone, integer) OWNER TO omniti; 
    10191034 
    10201035create or replace function 
     
    10691084$$ language 'plpgsql'; 
    10701085 
    1071 create or replace function 
    1072 stratcon.fetch_dataset(in_check uuid, 
    1073                        in_name text, 
    1074                        in_start_time timestamptz, 
    1075                        in_end_time timestamptz, 
    1076                        in_hopeful_nperiods int, 
    1077                        derive boolean) 
    1078 returns setof stratcon.rollup_matrix_numeric_5m as 
    1079 $$ 
     1086CREATE OR REPLACE FUNCTION stratcon.fetch_dataset(in_uuid uuid, in_name text, in_start_time timestamp with time zone, in_end_time timestamp with time zone, in_hopeful_nperiods integer, derive boolean) 
     1087  RETURNS SETOF stratcon.rollup_matrix_numeric_5m AS 
     1088$BODY$ 
     1089declare 
     1090  v_sid int; 
     1091begin 
     1092  select sid into v_sid from stratcon.map_uuid_to_sid where id = in_check; 
     1093  if not found then 
     1094    return; 
     1095  end if; 
     1096 
     1097  return query select * from stratcon.fetch_dataset(v_sid::integer, in_name, in_start_time, in_end_time, in_hopeful_nperiods, derive); 
     1098end 
     1099$BODY$ 
     1100  LANGUAGE 'plpgsql' VOLATILE 
     1101  COST 100 
     1102  ROWS 1000; 
     1103ALTER FUNCTION stratcon.fetch_dataset(uuid, text, timestamp with time zone, timestamp with time zone, integer, boolean) OWNER TO omniti; 
     1104 
     1105CREATE OR REPLACE FUNCTION stratcon.fetch_dataset(in_sid integer, in_name text, in_start_time timestamp with time zone, in_end_time timestamp with time zone, in_hopeful_nperiods integer, derive boolean) 
     1106  RETURNS SETOF stratcon.rollup_matrix_numeric_5m AS 
     1107$BODY$ 
    10801108declare 
    10811109  v_sql text; 
     
    10911119 
    10921120  -- Map out uuid to an sid. 
    1093   select sid into v_sid from stratcon.map_uuid_to_sid where id = in_check; 
    1094   if not found then 
    1095     return; 
    1096   end if; 
     1121  v_sid := in_sid; 
    10971122 
    10981123  select * into v_target from stratcon.choose_window(in_start_time, in_end_time, in_hopeful_nperiods); 
     
    11521177  return; 
    11531178end 
    1154 $$ language 'plpgsql'; 
    1155  
     1179$BODY$ 
     1180  LANGUAGE 'plpgsql' VOLATILE 
     1181  COST 100 
     1182  ROWS 1000; 
     1183ALTER FUNCTION stratcon.fetch_dataset(integer, text, timestamp with time zone, timestamp with time zone, integer, boolean) OWNER TO omniti; 
    11561184 
    11571185-- Remove Metric based on UUID and Metric_Name