DDieterich / DTGen

DTGEN Code Generation Tool for Relational Designers (See Wiki Branch)
http://dtgen.org
3 stars 0 forks source link

Add a Name-Value Pair Table to All Applications #112

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What will the enhancement do?

 -) Add a Name-Value Pair Table to all generated applications.  It is a simple way to store simple attributes for the application.  Also functions get_nvp and put_nvp will retrieve and store values, respectively.

How is this currently done or handled?

 -) Must be done manually.

What version of the product are you using? On what operating system?

 -) Pre-Release 0.12

Please provide any additional information below.

create table nvps
   (name    varchar2(30)
   ,value   varchar2(4000)
   ,constraint nvps_pk primary key (name)
   ) organization index overflow storage (initial 4k)
     --tablespace ts_name;
comment on table nvps is 'Name-Value Pairs Table for System Parameters';
comment on column nvps.name is 'Name for Name-Value Pair';
comment on column nvps.value is 'Value for Name-Value Pair';

Original issue reported on code.google.com by duane.di...@dmstex.com on 5 Dec 2012 at 5:05

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
-- Fix the Name portion of a Name-Value Pair
function fix_nvp_name
         (name_in   in  varchar2)
   return varchar2
is
begin
   return upper
            (regexp_replace
               (regexp_replace
                  (regexp_replace
                     (name_in
                     ,'^[[:space:]]+', '', 1)  -- Replace 1st occurance at beg
                  ,'[[:space:]]+$', '', 1)  -- Replace 1st occurance at end
               ,'[[:space:]]+', ' ', 0)  -- Replace ALL occurances
            );
end fix_nvp_name;
------------------------------------------------------------
-- Save a Name-Value Pair in the Database
procedure set_nvp
         (name_in   in  varchar2
         ,value_in  in  varchar2)
is
begin
   insert into nvps (name, value) values (fix_nvp_name(name_in), value_in);
exception
   when DUP_VAL_ON_INDEX then
      update nvps set value = value_in where name = name_in;
end set_nvp;
------------------------------------------------------------
-- Retreive a Name-Value Pair from the Database
function get_nvp
         (name_in in  varchar2)
      return varchar2
is
   retval  varchar2(4000);
begin
   select value into retval from nvps where name = fix_nvp_name(name_in);
   return retval;
exception when NO_DATA_FOUND then return null;
end get_nvp;

Original comment by duane.di...@dmstex.com on 13 Dec 2012 at 11:11

GoogleCodeExporter commented 9 years ago
------------------------------------------------------------
-- Save a Name-Value Pair in the Database
procedure set_nvp
         (name_in   in  varchar2
         ,value_in  in  varchar2
         ,descr_in  in  varchar2 default null)
is
begin
   insert into nvps (name, value, description)
      values (fix_nvp_name(name_in), value_in, descr_in);
exception
   when DUP_VAL_ON_INDEX then
      update nvps set value = value_in, description = descr_in
       where name = name_in;
end set_nvp;

Original comment by duane.di...@dmstex.com on 30 Dec 2012 at 1:48

GoogleCodeExporter commented 9 years ago
-- Name Value Pairs
create table nvps
   (name         varchar2(30)
   ,value        varchar2(4000)
   ,description  varchar2(100)
   ,constraint nvps_pk primary key (name)
   ) organization index overflow storage (initial 4k)
     --tablespace fcrs_load_indx
   ;
comment on table nvps is 'Name-Value Pairs Table for System Parameters';
comment on column nvps.name is 'Name for Name-Value Pair';
comment on column nvps.value is 'Value for Name-Value Pair';
comment on column nvps.description is 'Description for Name-Value Pair';

Original comment by duane.di...@dmstex.com on 30 Dec 2012 at 1:49