Commit 93d30019 authored by Malte Sussdorff's avatar Malte Sussdorff

Initial Import

parents
Pipeline #580 failed with stages
<?xml version="1.0"?>
<!-- Generated by the OpenACS Package Manager -->
<package key="ref-itu" url="http://openacs.org/repository/apm/packages/ref-itu" type="apm_service">
<package-name>Reference Data - ITU Code</package-name>
<pretty-plural>Reference Data - ITU Codes</pretty-plural>
<initial-install-p>f</initial-install-p>
<singleton-p>f</singleton-p>
<version name="0.1d" url="http://openacs.org/repository/download/apm/ref-itu-0.1d.apm">
<database-support>
<database>oracle</database>
<database>postgresql</database>
</database-support>
<owner url="mailto:jon@jongriffin.com">Jon Griffin</owner>
<summary>Telecom Country codes, ITU-T Recommendation E.164 for acs-reference.</summary>
<vendor url="http://www.mayuli.com">Mayuli Enterprises, LLC</vendor>
<description format="text/html">List of ITU-T Recommendation E.164 assigned country codes.</description>
<provides url="ref-itu" version="0.1d"/>
<requires url="acs-kernel" version="4.6"/>
<requires url="acs-reference" version="0.2d"/>
<files>
<file type="package_spec" path="ref-itu.info"/>
<file type="data_model" db_type="oracle" path="sql/common/ref-itu-data.sql"/>
<file type="data_model_create" db_type="oracle" path="sql/oracle/ref-itu-create.sql"/>
<file type="data_model_drop" db_type="oracle" path="sql/oracle/ref-itu-drop.sql"/>
<file type="data_model_create" db_type="postgresql" path="sql/postgresql/ref-itu-create.sql"/>
<file type="data_model_drop" db_type="postgresql" path="sql/postgresql/ref-itu-drop.sql"/>
</files>
<parameters>
<!-- No version parameters -->
</parameters>
</version>
</package>
This diff is collapsed.
-- packages/ref-itu/sql/postgresql/ref-itu-create.sql
--
-- @author jon@jongriffin.com.com
-- @creation-date 2003-02-25
-- @cvs-id $Id$
create table itu_notes (
note_id char(3)
constraint itu_notes_id_pk
primary key,
note varchar(1024)
constraint itu_notes_note_nn
not null
constraint itu_notes_note_uq
unique
);
create table itu_codes (
itu_id integer
constraint itu_code_pk
primary key,
code char(6)
constraint itu_code_nn
not null,
country varchar(100)
constraint itu_country_nn
not null,
note_id char(3)
constraint itu_codes_note_fk
references itu_notes (note_id)
);
comment on table itu_codes is '
This is the ITU country dialing code list.
';
-- add this table into the reference repository
declare
v_id integer;
begin
v_id := acs_reference.new (
table_name => 'itu_codes',
last_update => to_date('2002-05-01','YYYY-MM-DD'),
source => 'ITU',
source_url => 'http://www.itu.int/',
effective_date => '2002-05-01'
);
commit;
end;
/
-- This is the translated mapping of country names
-- Need to see if ITU used the same country names as ISO and if so, we can use those for
-- translated names, but they have some non-country names
@ '../common/ref-itu-data.sql'
-- Drop the ACS Reference ITU 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
declare
cursor refsrc_cur is
select table_name,
package_name,
repository_id
from acs_reference_repositories
where upper(table_name) like 'ITU_CODE%'
order by repository_id desc;
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.del(rec.repository_id);
end loop;
end;
/
show errors
-- drop the notes
drop table itu_notes;
-- packages/ref-itu/sql/postgresql/ref-itu-create.sql
--
-- @author jon@jongriffin.com.com
-- @creation-date 2003-02-25
-- @cvs-id $Id$
create table itu_notes (
note_id char(3)
constraint itu_notes_id_pk
primary key,
note text
constraint itu_notes_note_nn
not null
constraint itu_notes_note_uq
unique
);
create table itu_codes (
itu_id integer
constraint itu_code_pk
primary key,
code char(6)
constraint itu_code_nn
not null,
country varchar(100)
constraint itu_country_nn
not null,
note_id char(3)
constraint itu_codes_note_fk
references itu_notes (note_id)
);
comment on table itu_codes is '
This is the ITU country dialing code list.
';
-- add this table into the reference repository
select acs_reference__new (
'itu_codes', -- table_name
'2002-05-01',
'ITU', -- source
'http://www.itu.int/', -- source_url
to_date('2002-05-01','YYYY-MM-DD') -- effective_date
);
-- This is the translated mapping of country names
-- Need to see if ITU used the same country names as ISO and if so, we can use those for
-- translated names, but they have some non-country names
begin;
\i ../common/ref-itu-data.sql
end;
-- Drop the ACS Reference ITU data
--
-- @author jon@jongriffin.com
-- @cvs-id $Id$
-- 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 ''ITU_CODE%'' 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();
-- drop the notes
drop table itu_notes;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment