Giter VIP home page Giter VIP logo

app_parameter's Introduction

App_Parameter

An Oracle PL/SQL Application Parameter Module

App_Parameter is part of plsql_utilities. You can install it with or without the other utilities. Either clone the repository or download the zip archive (plsql_utilities.zip).

Description

General purpose application parameter set/get functionality with auditable history of changes. Use for storing values that might otherwise be hard-coded such as email addresses, application configuration information, and database instance specific settings (as might be important to differentiate between production and test environments).

Uses a common Data Warehouse pattern for "end dating" rather than deleting records, thus leaving an audit trail inside the main table. Only records with NULL end_date are "live" records. Records that are logically deleted have the end_date and end_dated_by fields populated. A logical update consists of a logical delete as described above plus an insert with the fields end_date and end_dated_by set to NULL.

The standalone function get_app_parameter uses RESULT_CACHE with the intent of being fast in a database with many different programs using the facility often. That may be overkill for your scenario, but it doesn't hurt anything. It returns NULL if the parameter name does not exist in the table.

    FUNCTION get_app_parameter(p_param_name VARCHAR2) RETURN VARCHAR2 RESULT_CACHE

Package app_parameter provides procedures for inserting and "end dating" records. A logical update with create_or_replace performs both operations. Grants to this package may well be different than those to get the parameter values. The package provides the following public subprograms:

    -- likely seldom used, "end date" a parameter without replacing it
    PROCEDURE end_app_parameter(p_param_name VARCHAR2); 
    --
    -- both inserts and updates
    --
    PROCEDURE create_or_replace(p_param_name VARCHAR2, p_param_value VARCHAR2);

    -- these are specialized for a scenario where production data is cloned to a test system 
    -- and you do not want the parameters from production used to do bad things in the test system
    -- before you get a chance to update them. Obscure and perhaps not useful to you.
    FUNCTION is_matching_database RETURN BOOLEAN;
    FUNCTION get_database_match RETURN VARCHAR2;
    PROCEDURE set_database_match; -- do this after updating the other app_parameters following a db refresh from production

The implemenation includes two triggers to prevent a well meaning coworker from performing invalid updates or deletes rather than using the procedures (or doing them correctly). These also add the userid and timestamp for new records that do not have values provided. This level of control is likely overkill, but it is nice to be able to tell an auditor or security reviewer that you have auditable change history on an important table that you will probably want to be able to update in production without a code promotion.

app_parameter's People

Watchers

 avatar Lee Lindley avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.