include ORDS modules in templates

This commit is contained in:
Ottmar Gobrecht 2019-08-19 17:10:09 +02:00
parent 88c5c23835
commit ab0426f628
5 changed files with 136 additions and 97 deletions

1
.gitignore vendored
View File

@ -7,3 +7,4 @@ plex_install_SYS.bat
plex_install_APEX_190100.bat
plex_install_PLEX_LIGHT.bat
todo.md
plex_test.sql

138
PLEX.pkb
View File

@ -42,6 +42,7 @@ TYPE tab_queries IS TABLE OF rec_queries INDEX BY BINARY_INTEGER;
TYPE tab_file_list_lookup IS TABLE OF PLS_INTEGER INDEX BY VARCHAR2(256);
TYPE rec_ddl_files IS RECORD (
ords_modules_ tab_vc1k,
sequences_ tab_vc1k,
tables_ tab_vc1k,
ref_constraints_ tab_vc1k,
@ -1022,6 +1023,12 @@ RETURN tab_export_files IS
v_cur obj_cur_typ;
v_query VARCHAR2(32767);
FUNCTION util_get_script_line (p_file_path VARCHAR2) RETURN VARCHAR2 IS
BEGIN
RETURN 'prompt --' || replace(p_file_path, '.sql', NULL)
|| c_lf || '@' || '../' || p_file_path || c_lf || c_lf;
END util_get_script_line;
PROCEDURE init IS
BEGIN
util_log_init(
@ -1147,28 +1154,61 @@ RETURN tab_export_files IS
$if $$ords_installed $then
PROCEDURE process_ords_modules IS
v_module_name user_ords_modules.name%type;
BEGIN
util_log_start(p_base_path_web_services || '/open_modules_cursor');
OPEN v_cur FOR 'select name from user_ords_modules';
util_log_stop;
--
LOOP
FETCH v_cur INTO v_module_name;
EXIT WHEN v_cur%notfound;
BEGIN
v_file_path := p_base_path_web_services || '/' || v_module_name || '.sql';
util_log_start(v_file_path);
util_clob_append(ords_export.export_module(p_module_name => v_module_name) || chr(10) || '/');
util_clob_add_to_export_files(
p_export_files => v_export_files,
p_name => v_file_path);
util_log_stop;
EXCEPTION
WHEN OTHERS THEN
util_log_error(v_file_path);
END;
END LOOP;
CLOSE v_cur;
PROCEDURE export_ords_modules IS
BEGIN
util_log_start(p_base_path_web_services || '/open_modules_cursor');
OPEN v_cur FOR 'select name from user_ords_modules';
util_log_stop;
--
LOOP
FETCH v_cur INTO v_module_name;
EXIT WHEN v_cur%notfound;
BEGIN
v_file_path := p_base_path_web_services || '/' || v_module_name || '.sql';
util_log_start(v_file_path);
util_clob_append(ords_export.export_module(p_module_name => v_module_name) || chr(10) || '/');
util_clob_add_to_export_files(
p_export_files => v_export_files,
p_name => v_file_path);
v_ddl_files.ords_modules_(v_ddl_files.ords_modules_.count + 1) := v_file_path;
util_log_stop;
EXCEPTION
WHEN OTHERS THEN
util_log_error(v_file_path);
END;
END LOOP;
CLOSE v_cur;
END export_ords_modules;
--
PROCEDURE create_ords_install_file IS
BEGIN
v_file_path := 'scripts/install_ords_modules_generated_by_plex.sql';
util_log_start(v_file_path);
util_clob_append('/* A T T E N T I O N
DO NOT TOUCH THIS FILE or set the PLEX.BackApp parameter p_include_ords_modules
to false - otherwise your changes would be overwritten on next PLEX.BackApp
call.
*/
set define off verify off feedback off
whenever sqlerror exit sql.sqlcode rollback
prompt --install_ords_modules_generated_by_plex
' );
FOR i IN 1..v_ddl_files.ords_modules_.count LOOP
util_clob_append(util_get_script_line(v_ddl_files.sequences_(i)));
END LOOP;
util_clob_add_to_export_files(
p_export_files => v_export_files,
p_name => v_file_path);
util_log_stop;
END create_ords_install_file;
BEGIN
export_ords_modules;
create_ords_install_file;
END process_ords_modules;
$end
@ -1628,13 +1668,6 @@ END;
END process_ref_constraints;
PROCEDURE create_backend_install_file IS
FUNCTION get_script_line (p_file_path VARCHAR2) RETURN VARCHAR2 IS
BEGIN
RETURN 'prompt --' || replace(p_file_path, '.sql', NULL)
|| c_lf || '@' || '../' || p_file_path || c_lf || c_lf;
END get_script_line;
BEGIN
v_file_path := 'scripts/install_backend_generated_by_plex.sql';
util_log_start(v_file_path);
@ -1652,46 +1685,46 @@ prompt --install_backend_generated_by_plex
' );
FOR i IN 1..v_ddl_files.sequences_.count LOOP
util_clob_append(get_script_line(v_ddl_files.sequences_(i)));
util_clob_append(util_get_script_line(v_ddl_files.sequences_(i)));
END LOOP;
FOR i IN 1..v_ddl_files.tables_.count LOOP
util_clob_append(get_script_line(v_ddl_files.tables_(i)));
util_clob_append(util_get_script_line(v_ddl_files.tables_(i)));
END LOOP;
FOR i IN 1..v_ddl_files.ref_constraints_.count LOOP
util_clob_append(get_script_line(v_ddl_files.ref_constraints_(i)));
util_clob_append(util_get_script_line(v_ddl_files.ref_constraints_(i)));
END LOOP;
FOR i IN 1..v_ddl_files.indices_.count LOOP
util_clob_append(get_script_line(v_ddl_files.indices_(i)));
util_clob_append(util_get_script_line(v_ddl_files.indices_(i)));
END LOOP;
FOR i IN 1..v_ddl_files.views_.count LOOP
util_clob_append(get_script_line(v_ddl_files.views_(i)));
util_clob_append(util_get_script_line(v_ddl_files.views_(i)));
END LOOP;
FOR i IN 1..v_ddl_files.types_.count LOOP
util_clob_append(get_script_line(v_ddl_files.types_(i)));
util_clob_append(util_get_script_line(v_ddl_files.types_(i)));
END LOOP;
FOR i IN 1..v_ddl_files.type_bodies_.count LOOP
util_clob_append(get_script_line(v_ddl_files.type_bodies_(i)));
util_clob_append(util_get_script_line(v_ddl_files.type_bodies_(i)));
END LOOP;
FOR i IN 1..v_ddl_files.triggers_.count LOOP
util_clob_append(get_script_line(v_ddl_files.triggers_(i)));
util_clob_append(util_get_script_line(v_ddl_files.triggers_(i)));
END LOOP;
FOR i IN 1..v_ddl_files.functions_.count LOOP
util_clob_append(get_script_line(v_ddl_files.functions_(i)));
util_clob_append(util_get_script_line(v_ddl_files.functions_(i)));
END LOOP;
FOR i IN 1..v_ddl_files.procedures_.count LOOP
util_clob_append(get_script_line(v_ddl_files.procedures_(i)));
util_clob_append(util_get_script_line(v_ddl_files.procedures_(i)));
END LOOP;
FOR i IN 1..v_ddl_files.packages_.count LOOP
util_clob_append(get_script_line(v_ddl_files.packages_(i)));
util_clob_append(util_get_script_line(v_ddl_files.packages_(i)));
END LOOP;
FOR i IN 1..v_ddl_files.package_bodies_.count LOOP
util_clob_append(get_script_line(v_ddl_files.package_bodies_(i)));
util_clob_append(util_get_script_line(v_ddl_files.package_bodies_(i)));
END LOOP;
FOR i IN 1..v_ddl_files.grants_.count LOOP
util_clob_append(get_script_line(v_ddl_files.grants_(i)));
util_clob_append(util_get_script_line(v_ddl_files.grants_(i)));
END LOOP;
FOR i IN 1..v_ddl_files.other_objects_.count LOOP
util_clob_append(get_script_line(v_ddl_files.other_objects_(i)));
util_clob_append(util_get_script_line(v_ddl_files.other_objects_(i)));
END LOOP;
util_clob_add_to_export_files(
p_export_files => v_export_files,
@ -1699,6 +1732,8 @@ prompt --install_backend_generated_by_plex
util_log_stop;
END create_backend_install_file;
PROCEDURE process_data IS
TYPE obj_rec_typ IS RECORD (
table_name VARCHAR2(256),
@ -1765,6 +1800,7 @@ SELECT table_name,
PROCEDURE create_template_files IS
v_file_template VARCHAR2(32767 CHAR);
BEGIN
-- the readme template
v_file_template := q'^Your Global README File
=======================
@ -1782,6 +1818,7 @@ for you:
- scripts/install_backend_generated_by_plex.sql
- scripts/install_frontend_generated_by_apex.sql
- scripts/install_ords_modules_generated_by_plex.sql
Do not touch these generated install files. They will be overwritten on each
plex call. Depending on your call parameters it would be ok to modify the file
@ -1814,6 +1851,8 @@ and modify it to your needs. Doing it this way your changes are overwrite save.
p_export_files => v_export_files,
p_name => v_file_path);
util_log_stop;
-- export and import template - used by three files
v_file_template := q'^rem Template generated by PLEX version {{PLEX_VERSION}}
rem More infos here: {{PLEX_URL}}
@ -1922,6 +1961,7 @@ if %errorlevel% neq 0 exit /b %errorlevel%
p_name => v_file_path);
util_log_stop;
-- export app custom code template
v_file_template := q'^-- Template generated by PLEX version {{PLEX_VERSION}}
-- More infos here: {{PLEX_URL}}
@ -2092,7 +2132,7 @@ prompt
p_export_files => v_export_files,
p_name => v_file_path);
util_log_stop;
--
-- install app custom code template
v_file_template := q'^-- Template generated by PLEX version {{PLEX_VERSION}}
-- More infos here: {{PLEX_URL}}
@ -2118,9 +2158,8 @@ set define off
prompt
prompt Start Installation
prompt =========================================================================
prompt Start backend installation
prompt Call PLEX backend install script
prompt Install backend
{{@}}install_backend_generated_by_plex.sql
prompt Compile invalid objects
@ -2150,7 +2189,10 @@ BEGIN
END;
{{/}}
prompt Start frontend installation
prompt Install ORDS modules
{{@}}install_ords_modules_generated_by_plex.sql
prompt Install APEX frontend
BEGIN
apex_application_install.set_workspace_id(APEX_UTIL.find_security_group_id(:app_workspace));
apex_application_install.set_application_alias(:app_alias);
@ -2159,9 +2201,7 @@ BEGIN
apex_application_install.generate_offset;
END;
{{/}}
prompt Call APEX frontend install script
{{@}}install_frontend_generated_by_APEX.sql
{{@}}install_frontend_generated_by_apex.sql
prompt =========================================================================
prompt Installation DONE :-)

View File

@ -212,20 +212,20 @@ WITH
p_app_include_single_file => false,
p_app_build_status_run_only => false,
-- ORDS Modules (only available, when ORDS is installed):
p_include_object_ddl => false,
p_include_ords_modules => false,
-- Schema Objects:
p_include_object_ddl => false,
p_object_type_like => NULL,
p_object_type_not_like => NULL,
p_object_name_like => NULL,
p_object_name_not_like => NULL,
-- Tbale Data:
-- Table Data:
p_include_data => false,
p_data_as_of_minutes_ago => 0,
p_data_max_rows => 1000,
p_data_table_name_like => NULL,
p_data_table_name_not_like => NULL,
-- Miscellaneous options:
-- General options:
p_include_templates => true,
p_include_runtime_log => true,
p_include_error_log => true,

View File

@ -152,20 +152,20 @@ WITH
p_app_include_single_file => false,
p_app_build_status_run_only => false,
-- ORDS Modules (only available, when ORDS is installed):
p_include_object_ddl => false,
p_include_ords_modules => false,
-- Schema Objects:
p_include_object_ddl => false,
p_object_type_like => NULL,
p_object_type_not_like => NULL,
p_object_name_like => NULL,
p_object_name_not_like => NULL,
-- Tbale Data:
-- Table Data:
p_include_data => false,
p_data_as_of_minutes_ago => 0,
p_data_max_rows => 1000,
p_data_table_name_like => NULL,
p_data_table_name_not_like => NULL,
-- Miscellaneous options:
-- General options:
p_include_templates => true,
p_include_runtime_log => true,
p_include_error_log => true,

82
package-lock.json generated
View File

@ -542,7 +542,8 @@
},
"ansi-regex": {
"version": "2.1.1",
"bundled": true
"bundled": true,
"optional": true
},
"aproba": {
"version": "1.2.0",
@ -560,11 +561,13 @@
},
"balanced-match": {
"version": "1.0.0",
"bundled": true
"bundled": true,
"optional": true
},
"brace-expansion": {
"version": "1.1.11",
"bundled": true,
"optional": true,
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
@ -577,15 +580,18 @@
},
"code-point-at": {
"version": "1.1.0",
"bundled": true
"bundled": true,
"optional": true
},
"concat-map": {
"version": "0.0.1",
"bundled": true
"bundled": true,
"optional": true
},
"console-control-strings": {
"version": "1.1.0",
"bundled": true
"bundled": true,
"optional": true
},
"core-util-is": {
"version": "1.0.2",
@ -688,7 +694,8 @@
},
"inherits": {
"version": "2.0.3",
"bundled": true
"bundled": true,
"optional": true
},
"ini": {
"version": "1.3.5",
@ -698,6 +705,7 @@
"is-fullwidth-code-point": {
"version": "1.0.0",
"bundled": true,
"optional": true,
"requires": {
"number-is-nan": "^1.0.0"
}
@ -710,17 +718,20 @@
"minimatch": {
"version": "3.0.4",
"bundled": true,
"optional": true,
"requires": {
"brace-expansion": "^1.1.7"
}
},
"minimist": {
"version": "0.0.8",
"bundled": true
"bundled": true,
"optional": true
},
"minipass": {
"version": "2.3.5",
"bundled": true,
"optional": true,
"requires": {
"safe-buffer": "^5.1.2",
"yallist": "^3.0.0"
@ -737,6 +748,7 @@
"mkdirp": {
"version": "0.5.1",
"bundled": true,
"optional": true,
"requires": {
"minimist": "0.0.8"
}
@ -809,7 +821,8 @@
},
"number-is-nan": {
"version": "1.0.1",
"bundled": true
"bundled": true,
"optional": true
},
"object-assign": {
"version": "4.1.1",
@ -819,6 +832,7 @@
"once": {
"version": "1.4.0",
"bundled": true,
"optional": true,
"requires": {
"wrappy": "1"
}
@ -894,7 +908,8 @@
},
"safe-buffer": {
"version": "5.1.2",
"bundled": true
"bundled": true,
"optional": true
},
"safer-buffer": {
"version": "2.1.2",
@ -924,6 +939,7 @@
"string-width": {
"version": "1.0.2",
"bundled": true,
"optional": true,
"requires": {
"code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0",
@ -941,6 +957,7 @@
"strip-ansi": {
"version": "3.0.1",
"bundled": true,
"optional": true,
"requires": {
"ansi-regex": "^2.0.0"
}
@ -979,11 +996,13 @@
},
"wrappy": {
"version": "1.0.2",
"bundled": true
"bundled": true,
"optional": true
},
"yallist": {
"version": "3.0.3",
"bundled": true
"bundled": true,
"optional": true
}
}
},
@ -1327,9 +1346,9 @@
"integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ="
},
"mixin-deep": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.1.tgz",
"integrity": "sha512-8ZItLHeEgaqEvd5lYBXfm4EZSFCX29Jb9K+lAHhDKzReKBQKj3R+7NOF6tjqYi9t4oI8VUfaWITJQm86wnXGNQ==",
"version": "1.3.2",
"resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.2.tgz",
"integrity": "sha512-WRoDn//mXBiJ1H40rqa3vH0toePwSsGb45iInWlTySa+Uu4k3tYUSxa2v1KqAiLtvlrSzaExqS1gtk96A9zvEA==",
"requires": {
"for-in": "^1.0.2",
"is-extendable": "^1.0.1"
@ -1640,9 +1659,9 @@
"integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc="
},
"set-value": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.0.tgz",
"integrity": "sha512-hw0yxk9GT/Hr5yJEYnHNKYXkIA8mVJgd9ditYZCe16ZczcaELYYcfvaXesNACk2O8O0nTiPQcQhGUQj8JLzeeg==",
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.1.tgz",
"integrity": "sha512-JxHc1weCN68wRY0fhCoXpyK55m/XPHafOmK4UWD7m2CI14GMcFypt4w/0+NV5f/ZMby2F6S2wwA7fgynh9gWSw==",
"requires": {
"extend-shallow": "^2.0.1",
"is-extendable": "^0.1.1",
@ -1893,35 +1912,14 @@
}
},
"union-value": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.0.tgz",
"integrity": "sha1-XHHDTLW61dzr4+oM0IIHulqhrqQ=",
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.1.tgz",
"integrity": "sha512-tJfXmxMeWYnczCVs7XAEvIV7ieppALdyepWMkHkwciRpZraG/xwT+s2JN8+pr1+8jCRf80FFzvr+MpQeeoF4Xg==",
"requires": {
"arr-union": "^3.1.0",
"get-value": "^2.0.6",
"is-extendable": "^0.1.1",
"set-value": "^0.4.3"
},
"dependencies": {
"extend-shallow": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz",
"integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=",
"requires": {
"is-extendable": "^0.1.0"
}
},
"set-value": {
"version": "0.4.3",
"resolved": "https://registry.npmjs.org/set-value/-/set-value-0.4.3.tgz",
"integrity": "sha1-fbCPnT0i3H945Trzw79GZuzfzPE=",
"requires": {
"extend-shallow": "^2.0.1",
"is-extendable": "^0.1.1",
"is-plain-object": "^2.0.1",
"to-object-path": "^0.3.0"
}
}
"set-value": "^2.0.1"
}
},
"unset-value": {