Index: openacs-4/packages/ref-language/sql/postgresql/ref-language-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ref-language/sql/postgresql/ref-language-drop.sql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/ref-language/sql/postgresql/ref-language-drop.sql 27 Aug 2001 22:20:07 -0000 1.2 +++ openacs-4/packages/ref-language/sql/postgresql/ref-language-drop.sql 15 Sep 2001 01:11:32 -0000 1.3 @@ -1,34 +1,26 @@ --- Drop the ACS Reference Language data --- Postgres version +-- Drop the ACS Reference Country data +-- -- @author jon@jongriffin.com -- @cvs-id $Id$ -set serveroutput on - -- drop all associated tables and packages -- I am not sure this is a good idea since we have no way to register -- if any other packages are using this data. -- This will probably fail if their is a child table using this. -- I can probably make this cleaner also, but ... no time today +create function inline_0() returns integer as ' declare - cursor refsrc_cur is - select table_name, - package_name, - repository_id - from acs_reference_repositories - where table_name = 'language_codes' + rec acs_reference_repositories%ROWTYPE; begin - for rec in refsrc_cur loop - dbms_output.put_line('Dropping ' || rec.table_name); - execute immediate 'drop table ' || rec.table_name; - if rec.package_name is not null then - execute immediate 'drop package ' || rec.package_name; - end if; - acs_reference.delete(rec.repository_id); + for rec in select * from acs_reference_repositories where upper(table_name) = ''LANGUAGE_CODES'' loop + execute ''drop table '' || rec.table_name; + perform acs_reference__delete(rec.repository_id); end loop; -end; -/ -show errors + return 0; +end;' language 'plpgsql'; +select inline_0(); +drop function inline_0(); + Index: openacs-4/packages/ref-us-zipcodes/sql/postgresql/ref-us-zipcodes-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ref-us-zipcodes/sql/postgresql/ref-us-zipcodes-drop.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/ref-us-zipcodes/sql/postgresql/ref-us-zipcodes-drop.sql 15 Sep 2001 01:11:32 -0000 1.1 @@ -0,0 +1,26 @@ +-- Drop the ACS Reference Country data +-- +-- @author jon@jongriffin.com +-- @cvs-id $Id: ref-us-zipcodes-drop.sql,v 1.1 2001/09/15 01:11:32 donb Exp $ + +-- drop all associated tables and packages +-- I am not sure this is a good idea since we have no way to register +-- if any other packages are using this data. + +-- This will probably fail if their is a child table using this. +-- I can probably make this cleaner also, but ... no time today + +create function inline_0() returns integer as ' +declare + rec acs_reference_repositories%ROWTYPE; +begin + for rec in select * from acs_reference_repositories where upper(table_name) like ''US_ZIP%'' loop + execute ''drop table '' || rec.table_name; + perform acs_reference__delete(rec.repository_id); + end loop; + return 0; +end;' language 'plpgsql'; + +select inline_0(); +drop function inline_0(); +