Revised string recognition and line injection

Modified   database/LOGGER/Packages/aop_processor.pkb
--MOD procedure splice - add l_leading_nl_offset, l_trailing_nl_offset
--MEANING of g_curremt_pos
--  p_pos - the current position is taken to indicate the next character to be read eg by regex_substr
--  so when you splice with current position, it is to be between pos-1 and pos
--Logic to manage NEW LINES
--  Current char is a NL - we want to skip it in the splice,
--  since we are going to add a NL infront of the splice anyway.
--  Apply a leading new line and indent by g_indent_spaces * p_indent
--  Add a trailing newline, because there is a word-char before the next NL.
--NEW FUNCTION trim_whitespace
--NEW FUNCTION flatten
--MOD FUNCTION get_next
--Param description
-- l_either_match is the match from both i_search and i_stop
-- i_modifier is applied to the std REGEXP_SUBSTR search
-- g_upto_pos is the start of the match
-- g_past_pos is the end of the match
-- IF i_trim_result    THEN stripped of upto 1 leading and trailing whitespace
-- IF i_trim_pointers  THEN g_upto_pos and g_past_pos will point to the start and stop of the trimmed match
-- IF match FROM i_search THEN g_current_pos will advance to g_past_pos, otherwise g_current_pos does not change.
-- IF i_upper    THEN  result is in UPPER
-- IF i_lower    THEN  result is in LOWER
-- IN HTML mode i_colour determines the highlighting used when the match is consumed (g_current_pos set to g_past_pos)
-- IF i_raise_error and NO MATCH, and exception is raises, and the search string written out.
--DEL FUNCTION get_next_lower - not worth keeping
--DEL FUNCTION get_next_upper - not worth keeping
--MOD PROCEDURE go_upto - now uses get_next to search
--DEL FUNCTION matched_with - use REGEXP_LIKE instead
--MOD PROCEDURE AOP_pu_params - change evaluation order to get best match of VAR TYPE
--FIX PROCEDURE AOP_declare - Ensure BEGIN is consumed before calling AOP_block
--MOD PROCEDURE AOP_is_as - don't pass i_inject_node, generate the injections here instead for
--    NEW PROCESS
--    NEW NODE
--Consume END if package BEGIN is not found.
--Set current pos to null, just to emphasise we are finished with this pass.
--MOD PROCEDURE AOP_block - raise error if expected keyword not found.
--FIX PROCEDURE AOP_pu_block - Ensure BEGIN is consumed before calling AOP_block
--Add extra BEGIN infront of existing BEGIN, ensuring not trimmed.
--FIX   function weave - Ensure BEGIN is consumed before calling AOP_block
APEX workaround for CLOB submit issue - take Compare Source page off the menu.

Modified   apex/f104/application/pages/page_00002.sql --label change
Modified   apex/f104/application/pages/page_00008.sql --Name changed 'Process Traces'
Modified   apex/f104/application/pages/page_00009.sql --Name changed 'Logger Control'
Modified   apex/f104/application/pages/page_00021.sql --Help Information
Modified   apex/f104/application/pages/page_00022.sql --Help Information
Modified   apex/f104/application/pages/page_00023.sql - Region name change 'Compare Source'
Modified   apex/f104/application/pages/page_00101.sql - auto changes, probably related to public page
Modified   apex/f104/application/shared_components/navigation/breadcrumbs.sql
Deleted    apex/f104/application/shared_components/navigation/tabs/standard/source.sql
Modified   apex/f104/application/shared_components/navigation/tabs/standard/t_processes.sql
Modified   apex/f104/application/shared_components/navigation/tabs/standard/t_registry.sql
Modified   apex/f104/install.sql
Add        apex/f104/application/shared_components/navigation/tabs/standard/aop_source.sql
Indent is now calculated from the block opening keywords.

Modified   database/LOGGER/Packages/aop_processor.pkb
--MOD Block Open REGEXs to search for LF+spaces+keyword
--NEW FUNCTION calc_indent takes the current indent and the last match.
--  Calcs new indent if leading char is LF. -> Count leading spaces
--  Uses as the i_indent param to most routines that have this param.
--  Eg AOP_block
Auto Info messages for report triggers

Modified   database/LOGGER/Packages/aop_processor.pkb
--MOD PROCEDURE AOP_pu_block - Add INFO for report trigger BEFOREPFORM and AFTERREPORT
Fixes for indents, multiple tables with same name, supported types.

Modified   database/LOGGER/Packages/aop_processor.pkb
Modified   database/LOGGER/Packages/aop_processor.pks
--NEW global  g_end_user --owner for normal packages, invoker for invoker packages.
--NEW FUNCTION table_owner
--MOD PROCEDURE AOP_pu_params, FUNCTION AOP_var_defs, PROCEDURE AOP_block
-- - calc l_table_owner using FUNCTION table_owner
-- - swap all_tab_columns for user_tab_columns
--REPLACE use of DB function supported_data_type WITH REGEXP_LIKE(x , G_REGEX_SUPPORTED_TYPES)
--PROCEDURE AOP_block - change calls to calc_indent passing a better default indent, that will work well, if match param is useless, eg if there is no leading NL
--MOD function weave - new param p_end_user - sets g_end_user
--MOD procedure advise_package - passes p_end_user to weave
Modified   database/LOGGER/UnitTest/aop_test.pkb
--Additional tests.
Modified   database/LOGGER/Views/aop_source_v.vw
--Fixed the outer joins
Modified   database/SYS/Users/logger.user
--grant select any table to logger;
Derive module type and owner - store on process

Modified   apex/f104/application/pages/page_00008.sql
--FIX swap ms_metacode.purge_old_processes to ms_logger.purge_old_processes
Modified   apex/f104/application/pages/page_00009.sql
--ADD P9_NUM_ROWS and P9_GO - control rows displayed
Modified   apex/f104/application/pages/page_00010.sql
--ADD P10_NUM_ROWS and P10_GO - control rows displayed
Modified   apex/f104/application/pages/page_00021.sql
--ADD P21_SCHEMA - and pass it to aop_processor.weave
Modified   database/LOGGER/Packages/ms_logger.pkb
Modified   database/LOGGER/Packages/ms_logger.pks
--NEW FUNCTION object_owner
--NEW FUNCTION object_type
--MOD FUNCTION find_module - Derive module type and owner
--NEW PROCEDURE reset_sequence - does not yet work.
--MOD FUNCTION new_process - new params i_module_name and i_unit_name
--  will look up module_type and unit_type
Modified   database/LOGGER/Tables/ms_tables.tab
--alter table ms_module add owner varchar2(30);
Fixed?? a bizarre error with apparent incomplete restoration of quotes.

Occurred where quotes where nested '   ''   '
But problem noticed in 1 piece of target code "rep_pb_pack" and only in the clean AOP version.
Seemed to dissapear after trimming clob.  I only did this because i noticed the problem occurred when
using reapply_aspect, but not with QUICK AOP in the App.

Modified   database/LOGGER/Packages/aop_processor.pkb
--NEW EXCEPTION x_restore_failed
--NEW FUNCTION trim_clob
--MOD function weave    - handles x_restore_failed (however most likely never get this error)
--                      - uses trim_clob on result.
--MOD function get_body - uses trim_clob on result.
--MOD procedure reapply_aspect - use UPPER on i_object_name
--MOD procedure restore_comments_and_quotes - uglify with exception generation.
Modified   database/LOGGER/Packages/ms_logger.pkb
Modified   database/LOGGER/Packages/ms_logger.pks
--MOVE constants to the spec for MSG_LEVEL, MSG_MODE, OPEN_PROCESS
--NB - Now able to use package constants in SQL (without need for functions)
Added a 3rd step to Quick AOP - for debugging purposes.

Modified   apex/f104/application/create_application.sql
Modified   apex/f104/application/pages/page_00002.sql
--break_on 'USING_AOP'
Modified   apex/f104/application/pages/page_00009.sql
--Add static LOV to module_type
--Change label and image on link to Unit Registry
--Add buttons ALL_QUIET, ALL_NORMAL, ALL_DEBUG, REPORT_STD to set msg_level and open_process on module and units.
--New processes for the new buttons.
Modified   apex/f104/application/pages/page_00010.sql
--Add button OVERRIDDEN
--NEW process SetAllOverridden
Modified   apex/f104/application/pages/page_00022.sql
--Added a NEXT button and new process to create clean AOP in collection AOP_OUTPUT_CLEAN for step 3.
Modified   apex/f104/application/pages/page_00024.sql
--New saved report 'No debugging'
Add        apex/f104/application/pages/page_00025.sql
--like p22 loads AOP_OUTPUT_CLEAN into a textarea.
Modified   apex/f104/application/set_environment.sql
Modified   apex/f104/application/shared_components/navigation/breadcrumbs.sql            - for p25
Modified   apex/f104/application/shared_components/navigation/tabs/standard/t_plugin.sql - for p25
Modified   apex/f104/install.sql                                                         - for p25
NEW Patch: LOG-01_07A_07B_SYS - Extra grants
NEW Patch: LOG-01_07A_07B_LOGGER - See commit summary

+ Added a 3rd step to Quick AOP - for debugging purposes.
+ Fixed?? a bizarre error with apparent incomplete restoration of quotes.
+ Derive module type and owner - store on process
+ Fixes for indents, multiple tables with same name, supported types.
+ Auto Info messages for report triggers
+ Indent is now calculated from the block opening keywords.
+ APEX workaround for CLOB submit issue - take Compare Source page off the menu.
+ Revised string recognition and line injection
+ Improving Quiet Mode - relogging nodes in DEBUG mode.
+ Ensure trace file link only when a process has created a traversal.
+ Ensuring we can start a process passing a report_id and then retrieve the results from forms with that report_id.
+ Removing extra lines from Injection.
+ AOP_pu_params now searches for %ROWTYPE and %TYPE params
+ Minor refactor AOP_pu_params
Fixed missing grant
Fixed orphaned error nodes

Modified   database/LOGGER/Packages/ms_logger.pkb
--FIX PROCEDURE log_node - passed i_parent_index - uses to find parent_traversal_id
--FIX PROCEDURE dump_nodes - passes i_parent_index to log_node (using g_nodes.PRIOR(i_index))
--FIX PROCEDURE create_traversal - passes i_parent_index to log_node (using f_index)
NEW Patch: LOG-01_08A_08B_LOGGER - Fixed orphaned error nodes
Create message mode "Disabled"

Modified   apex/f104/application/pages/page_00008.sql
--ADD P8_SHOW_MODULE_YN and use it to display modules optionally in the tree.
Modified   apex/f104/application/pages/page_00009.sql
--Add to 'MODULE_TYPE' list "Disabled"
--Enhance Std Report mode to
--Set Report Library Modules to Disabled
--Set Report Library Units to Overridden
--"Reports are now in Standard mode.
--IE Reports will open processes in Normal mode, and 'get_parameters' is set to Debug.
--Report Libraries are set to disabled, to keep the tree neater."

Modified   apex/f104/application/pages/page_00010.sql
--Add to 'UNIT_TYPE' list "Disabled"

Modified   database/LOGGER/Packages/ms_logger.pkb
Modified   database/LOGGER/Packages/ms_logger.pks
--NEW constant G_UNIT_TYPE_SQL, G_MODULE_TYPE_SQL
--MOD PROCEDURE  log_message - skip disabled nodes.
--MOD PROCEDURE create_ref   - skip disabled nodes.
--NEW PROCEDURE  set_unit_disabled
--MOD PROCEDURE create_traversal - create disabled nodes, but don't log them or stack them
--NEW FUNCTION new_script
NEW Patch: LOG-04_01A_01B_LOGGER - Create message mode
Fix patch LOG-04_01A_01B_LOGGER

Was not writing any messages as it was testing wrong msg_mode, now deleted.

Modified   database/LOGGER/Packages/ms_logger.pkb
Modified   database/LOGGER/Packages/ms_logger.pks
Modified   patch/feature/logger/LOG-04/LOG-04_01A_01B_LOGGER/ms_logger.pkb
Modified   patch/feature/logger/LOG-04/LOG-04_01A_01B_LOGGER/ms_logger.pks
--FIX TYPE node_typ - DEL msg_mode, tests now check i_node.traversal.msg_mode
Add an Owner selector to the Logger Control

Modified   apex/f104/application/pages/page_00009.sql
--Add an Owner selector - defaults to MIN not LOGGER schema
--Module list will show nothing if no owner selected. (which should be rare)
--Add an 'ALL_DISABLED' button.
--Limit processes that update records to the selected owner.
Drop tables to recreate with new constraints

Modified   database/LOGGER/Tables/ms_tables.tab
Refactor with just 1 message Tables/ms_tables.tab

1st draft

Modified   database/LOGGER/Packages/ms_logger.pks
--REPLACE TYPE ref_list with TYPE message_list
--MOD TYPE node_typ now has a unlogged_messages list
--NEW Constants
--  G_MSG_TYPE_PARAM
--  G_MSG_TYPE_NOTE
--  G_MSG_TYPE_MESSAGE
Modified   database/LOGGER/Packages/ms_logger.pkb
--MOD PROCEDURE err_create_internal_error - i_message now CLOB, inserts into ms_message
--MOD PROCEDURE log_node - now handles unlogged_messages
--REPLACE PROCEDURE log_ref with PROCEDURE log_message (DEL former log_message after incorporating some of its logic)
--REPLACE PROCEDURE push_ref with PROCEDURE push_message
--REPLACE PROCEDURE create_ref with PROCEDURE create_message
--MOD PROCEDURE debug_error - uses message create_message
--MOD PROCEDURE create_ref - now simply calls create_message
--MOD PROCEDURE purge_old_processes - now deletes from just ms_process
--MOD PROCEDUREs comment, info, warning, fatal uses create_message.
--  Remove i_raise_app_error param. and PROCEDURE app_error
--MOD ref procedures, removed i_desc param - not needed.
Modified   database/LOGGER/Tables/ms_tables.tab
--MOD TABLE MS_MESSAGE - now includes NAME and MSG_TYPE. TIME_NOW is a timestamp
--DEL TABLE MS_REFERENCE
--DEL TABLE MS_LARGE_MESSAGE
--DEL TABLE MS_INTERNAL_ERROR
Modified   database/LOGGER/Views/ms_views.vw
--MOD ms_message_vw - now only needs ms_message.
--separates message field into value and message based on length of message and presence of NL
--TEMP MOD ms_unit_vw and ms_module_vw, comment out ms_metacode calls that have been replaced in branch LOG-01 already.
--DEL ms_traversal_ref_vw
--MOD ms_traversal_message_vw - now REPLACES ms_traversal_message_ref_vw
Refactor with just 1 message Tables/ms_tables.tab

Final version

Modified   database/LOGGER/Packages/ms_logger.pkb
--ADD constant G_REF_VALUE_WIDTH
--MOD PROCEDURE create_message - added param - i_value, written to ms_message
--MOD PROCEDURE warn_user_source_error_lines
--Write the source line to a message in the format "LINE NO"  X  TEXT
--Highlight the error line as a WARNING, lines above and below as COMMENT
--PROCEDURE create_ref - decides whether to use the CLOB field or not.
--Short, single line value, so just put it in the value column
--Longer or multi-line value, put it in the message column
Modified   database/LOGGER/Tables/ms_tables.tab
--MOD TABLE MS_MESSAGE - ADD value column
Modified   database/LOGGER/Views/ms_views.vw
--MOD VIEW ms_message_vw - output value and message without CASE.