-
Notifications
You must be signed in to change notification settings - Fork 567
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#7137 Fenster für externe System-Meldungen
#10691 - create index ad_pinstance_log_ad_pinstance_id_created - create index ad_pinstance_para_perf - create db function cast_to_numeric_or_null - create view ExternalSystem_Config_PInstance_Log_v - create Window External System Log
- Loading branch information
1 parent
b31f189
commit 6dee32d
Showing
6 changed files
with
2,133 additions
and
0 deletions.
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
...ere.adempiere/migration/src/main/sql/postgresql/ddl/functions/cast_to_numeric_or_null.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
CREATE OR REPLACE FUNCTION cast_to_numeric_or_null(p_string text) RETURNS NUMERIC AS | ||
$$ | ||
BEGIN | ||
RETURN p_string::NUMERIC; | ||
EXCEPTION WHEN others THEN | ||
RETURN NULL; | ||
END; | ||
$$ | ||
STRICT | ||
LANGUAGE plpgsql IMMUTABLE; | ||
COMMENT ON FUNCTION cast_to_numeric_or_null(text) is 'Attempts to cast the given p_string to numeric. Returns null if that fails. Thx to https://stackoverflow.com/a/16206123/1012103'; |
28 changes: 28 additions & 0 deletions
28
...ere/migration/src/main/sql/postgresql/ddl/views/ExternalSystem_Config_PInstance_Log_v.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
DROP VIEW IF EXISTS ExternalSystem_Config_PInstance_Log_v; | ||
|
||
CREATE OR REPLACE VIEW ExternalSystem_Config_PInstance_Log_v AS | ||
SELECT pi.ad_process_id, | ||
pil.ad_pinstance_id AS ExternalSystem_Config_PInstance_Log_v_ID, | ||
pip_request.info AS External_Request, | ||
pil.p_msg, | ||
pil.p_date, | ||
pi.ad_client_id, | ||
COALESCE( | ||
NULLIF(pi.record_id, '0'), /*Record_ID is not set then the process was called from AD_Scheduler */ | ||
cast_to_numeric_or_null(pip_config.p_string)) AS ExternalSystem_Config_ID, | ||
pi.ad_org_id, | ||
pi.ad_pinstance_id, | ||
pi.isprocessing, | ||
pi.errormsg, | ||
now() as created, | ||
100 as createdby, | ||
now() as updated, | ||
100 as updatedby, | ||
'Y' as isactive | ||
FROM ad_pinstance pi | ||
JOIN ad_pinstance_para pip_request ON pi.ad_pinstance_id = pip_request.ad_pinstance_id AND pip_request.parametername = 'External_Request' | ||
LEFT JOIN ad_pinstance_para pip_config ON pi.ad_pinstance_id = pip_config.ad_pinstance_id AND pip_config.parametername = 'ChildConfigId' | ||
JOIN ad_pinstance_log pil ON pil.ad_pinstance_id = pi.ad_pinstance_id | ||
WHERE pi.AD_Table_ID = get_table_id('ExternalSystem_Config') /*AD_Table_ID is not set then the process was called from AD_Scheduler */ | ||
OR pip_config.parametername = 'ChildConfigId' | ||
; |
11 changes: 11 additions & 0 deletions
11
...ystem/10-de.metas.adempiere/5580090_sys_gh10691_CreateCast_to_numeric_or_nullFunction.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
CREATE OR REPLACE FUNCTION cast_to_numeric_or_null(p_string text) RETURNS NUMERIC AS | ||
$$ | ||
BEGIN | ||
RETURN p_string::NUMERIC; | ||
EXCEPTION WHEN others THEN | ||
RETURN NULL; | ||
END; | ||
$$ | ||
STRICT | ||
LANGUAGE plpgsql IMMUTABLE; | ||
COMMENT ON FUNCTION cast_to_numeric_or_null(text) is 'Attempts to cast the given p_string to numeric. Returns null if that fails. Thx to https://stackoverflow.com/a/16206123/1012103'; |
29 changes: 29 additions & 0 deletions
29
.../10-de.metas.adempiere/5580170_sys_gh10691_ExternalSystem_Config_PInstance_Log_v_View.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
|
||
DROP VIEW IF EXISTS ExternalSystem_Config_PInstance_Log_v; | ||
|
||
CREATE OR REPLACE VIEW ExternalSystem_Config_PInstance_Log_v AS | ||
SELECT pi.ad_process_id, | ||
pil.ad_pinstance_id AS ExternalSystem_Config_PInstance_Log_v_ID, | ||
pip_request.info AS External_Request, | ||
pil.p_msg, | ||
pil.p_date, | ||
pi.ad_client_id, | ||
COALESCE( | ||
NULLIF(pi.record_id, '0'), /*Record_ID is not set then the process was called from AD_Scheduler */ | ||
cast_to_numeric_or_null(pip_config.p_string)) AS ExternalSystem_Config_ID, | ||
pi.ad_org_id, | ||
pi.ad_pinstance_id, | ||
pi.isprocessing, | ||
pi.errormsg, | ||
now() as created, | ||
100 as createdby, | ||
now() as updated, | ||
100 as updatedby, | ||
'Y' as isactive | ||
FROM ad_pinstance pi | ||
JOIN ad_pinstance_para pip_request ON pi.ad_pinstance_id = pip_request.ad_pinstance_id AND pip_request.parametername = 'External_Request' | ||
LEFT JOIN ad_pinstance_para pip_config ON pi.ad_pinstance_id = pip_config.ad_pinstance_id AND pip_config.parametername = 'ChildConfigId' | ||
JOIN ad_pinstance_log pil ON pil.ad_pinstance_id = pi.ad_pinstance_id | ||
WHERE pi.AD_Table_ID = get_table_id('ExternalSystem_Config') /*AD_Table_ID is not set then the process was called from AD_Scheduler */ | ||
OR pip_config.parametername = 'ChildConfigId' | ||
; |
Oops, something went wrong.