Remove schema constants

This commit is contained in:
Jan Kvetina 2022-01-31 05:54:47 +01:00
parent 35946a4753
commit 5aa605403a
4 changed files with 40 additions and 40 deletions

View File

@ -29,11 +29,8 @@ CREATE OR REPLACE PACKAGE app AS
*
*/
--
core_alias CONSTANT VARCHAR2(30) := 'CORE';
--
schema_owner CONSTANT VARCHAR2(30) := 'CORE';
schema_apex CONSTANT VARCHAR2(30) := 'APEX_210100';
-- CORE application alias
core_alias CONSTANT VARCHAR2(30) := 'CORE'; -- better than hardcode app number
-- code for app exception
app_exception_code CONSTANT PLS_INTEGER := -20000;
@ -127,6 +124,17 @@ CREATE OR REPLACE PACKAGE app AS
--
-- Return current schema owner (because APEX dont like using USER)
--
FUNCTION get_owner (
in_app_id apps.app_id%TYPE
)
RETURN apex_applications.owner%TYPE
RESULT_CACHE;
--
-- Get home page (number) for selected/current application
--
@ -251,16 +259,6 @@ CREATE OR REPLACE PACKAGE app AS
--
-- Return current owner (because APEX dont like using USER)
--
FUNCTION get_owner (
in_app_id apps.app_id%TYPE := NULL
)
RETURN apex_applications.owner%TYPE;

View File

@ -62,6 +62,26 @@ CREATE OR REPLACE PACKAGE BODY app AS
FUNCTION get_owner (
in_app_id apps.app_id%TYPE
)
RETURN apex_applications.owner%TYPE
RESULT_CACHE
AS
out_owner apex_applications.owner%TYPE;
BEGIN
SELECT a.owner INTO out_owner
FROM apex_applications a
WHERE a.application_id = in_app_id;
--
RETURN out_owner;
EXCEPTION
WHEN NO_DATA_FOUND THEN
RETURN NULL;
END;
FUNCTION get_app_homepage (
in_app_id apps.app_id%TYPE := NULL
)
@ -319,25 +339,6 @@ CREATE OR REPLACE PACKAGE BODY app AS
FUNCTION get_owner (
in_app_id apps.app_id%TYPE := NULL
)
RETURN apex_applications.owner%TYPE
AS
out_owner apex_applications.owner%TYPE;
BEGIN
SELECT a.owner INTO out_owner
FROM apex_applications a
WHERE a.application_id = COALESCE(in_app_id, app.get_app_id());
--
RETURN out_owner;
EXCEPTION
WHEN NO_DATA_FOUND THEN
RETURN app.schema_owner;
END;
PROCEDURE create_session
AS
PRAGMA AUTONOMOUS_TRANSACTION;
@ -2796,7 +2797,7 @@ CREATE OR REPLACE PACKAGE BODY app AS
BEGIN
-- better version of DBMS_UTILITY.FORMAT_CALL_STACK
FOR i IN REVERSE NVL(in_offset, 2) .. UTL_CALL_STACK.DYNAMIC_DEPTH LOOP -- 2 = ignore this function, 3 = ignore caller
CONTINUE WHEN in_skip_others AND NVL(UTL_CALL_STACK.OWNER(i), '-') != app.schema_owner;
CONTINUE WHEN in_skip_others AND NVL(UTL_CALL_STACK.OWNER(i), '-') NOT IN (app.get_owner(app.get_app_id()), app.get_owner(app.get_core_app_id()));
--
out_module := SUBSTR(UTL_CALL_STACK.CONCATENATE_SUBPROGRAM(UTL_CALL_STACK.SUBPROGRAM(i)), 1, app.length_module);
out_stack := out_stack || out_module || CASE WHEN in_line_numbers THEN ' [' || TO_CHAR(UTL_CALL_STACK.UNIT_LINE(i)) || ']' END || in_splitter;
@ -2845,7 +2846,8 @@ CREATE OR REPLACE PACKAGE BODY app AS
AS
out_stack VARCHAR2(32767);
BEGIN
out_stack := REPLACE(REPLACE(in_stack, 'WWV_FLOW', '%'), app.schema_apex, '%');
out_stack := REPLACE(in_stack, 'WWV_FLOW', '%');
out_stack := REGEXP_REPLACE(out_stack, 'APEX_\d{6}', '%');
--
out_stack := REGEXP_REPLACE(out_stack, '\s.*SQL.*\.EXEC.*\]', '.');
out_stack := REGEXP_REPLACE(out_stack, '\s%.*EXEC.*\]', '.');

View File

@ -2,7 +2,7 @@ CREATE OR REPLACE VIEW obj_tables_ref_objects AS
WITH x AS (
SELECT /*+ MATERIALIZE */
app.get_app_id() AS app_id,
app.get_owner() AS owner_,
app.get_owner(app.get_app_id()) AS owner_,
app.get_item('$TABLE_NAME') AS table_name
FROM DUAL
)

View File

@ -2,7 +2,7 @@ CREATE OR REPLACE VIEW obj_tables_ref_pages AS
WITH x AS (
SELECT /*+ MATERIALIZE */
app.get_app_id() AS app_id,
app.get_owner() AS owner_,
app.get_owner(app.get_app_id()) AS owner_,
app.get_item('$TABLE_NAME') AS table_name
FROM DUAL
)