Skip to content

Commit eff1cba

Browse files
committed
add parameter p_dml_view_trigger_name
1 parent 1db2c06 commit eff1cba

File tree

9 files changed

+219
-83
lines changed

9 files changed

+219
-83
lines changed

README.md

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ SIGNATURE
7979
```sql
8080
PACKAGE om_tapigen AUTHID CURRENT_USER IS
8181
c_generator CONSTANT VARCHAR2(10 CHAR) := 'OM_TAPIGEN';
82-
c_generator_version CONSTANT VARCHAR2(10 CHAR) := '0.5.2.33';
82+
c_generator_version CONSTANT VARCHAR2(10 CHAR) := '0.5.2.34';
8383
```
8484

8585

@@ -114,10 +114,11 @@ PROCEDURE compile_api
114114
p_double_quote_names IN BOOLEAN DEFAULT TRUE, -- If true, object names (owner, table, columns) are placed in double quotes.
115115
p_default_bulk_limit IN INTEGER DEFAULT 1000, -- The default bulk size for the set based methods (create_rows, read_rows, update_rows)
116116
p_enable_dml_view IN BOOLEAN DEFAULT FALSE, -- If true, a view with an instead of trigger is generated, which simply calls the API methods - can be useful for low code frontends like APEX.
117-
p_dml_view_name IN VARCHAR2 DEFAULT NULL, -- If not null, the given name is used for the DML view - you can use substitutions like #TABLE_NAME# or #TABLE_NAME_4_20# (treated as substr(table_name, 4, 20)).
117+
p_dml_view_name IN VARCHAR2 DEFAULT NULL, -- If not null, the given name is used for the DML view - you can use substitutions like #TABLE_NAME# , #TABLE_NAME_26# or #TABLE_NAME_4_20# (treated as substr(table_name, 4, 20)).
118+
p_dml_view_trigger_name IN VARCHAR2 DEFAULT NULL, -- If not null, the given name is used for the DML view trigger - you can use substitutions like #TABLE_NAME#, #TABLE_NAME_26# or #TABLE_NAME_4_20# (treated as substr(table_name, 4, 20)).
118119
p_enable_one_to_one_view IN BOOLEAN DEFAULT FALSE, -- If true, a 1:1 view with read only is generated - useful when you want to separate the tables into an own schema without direct user access.
119-
p_one_to_one_view_name IN VARCHAR2 DEFAULT NULL, -- If not null, the given name is used for the 1:1 view - you can use substitutions like #TABLE_NAME# or #TABLE_NAME_4_20# (treated as substr(table_name, 4, 20)).
120-
p_api_name IN VARCHAR2 DEFAULT NULL, -- If not null, the given name is used for the API - you can use substitutions like #TABLE_NAME# or #TABLE_NAME_4_20# (treated as substr(table_name, 4, 20)).
120+
p_one_to_one_view_name IN VARCHAR2 DEFAULT NULL, -- If not null, the given name is used for the 1:1 view - you can use substitutions like #TABLE_NAME#, #TABLE_NAME_26# or #TABLE_NAME_4_20# (treated as substr(table_name, 4, 20)).
121+
p_api_name IN VARCHAR2 DEFAULT NULL, -- If not null, the given name is used for the API - you can use substitutions like #TABLE_NAME#, #TABLE_NAME_26# or #TABLE_NAME_4_20# (treated as substr(table_name, 4, 20)).
121122
p_sequence_name IN VARCHAR2 DEFAULT NULL, -- If not null, the given name is used for the create_row methods - same substitutions like with API name possible.
122123
p_exclude_column_list IN VARCHAR2 DEFAULT NULL, -- If not null, the provided comma separated column names are excluded on inserts and updates (virtual columns are implicitly excluded).
123124
p_audit_column_mappings IN VARCHAR2 DEFAULT NULL, -- If not null, the provided comma separated column names are excluded and populated by the API (you don't need a trigger for update_by, update_on...).
@@ -163,10 +164,11 @@ FUNCTION compile_api_and_get_code
163164
p_double_quote_names IN BOOLEAN DEFAULT TRUE, -- If true, object names (owner, table, columns) are placed in double quotes.
164165
p_default_bulk_limit IN INTEGER DEFAULT 1000, -- The default bulk size for the set based methods (create_rows, read_rows, update_rows)
165166
p_enable_dml_view IN BOOLEAN DEFAULT FALSE, -- If true, a view with an instead of trigger is generated, which simply calls the API methods - can be useful for low code frontends like APEX.
166-
p_dml_view_name IN VARCHAR2 DEFAULT NULL, -- If not null, the given name is used for the DML view - you can use substitutions like #TABLE_NAME# or #TABLE_NAME_4_20# (treated as substr(table_name, 4, 20)).
167+
p_dml_view_name IN VARCHAR2 DEFAULT NULL, -- If not null, the given name is used for the DML view - you can use substitutions like #TABLE_NAME# , #TABLE_NAME_26# or #TABLE_NAME_4_20# (treated as substr(table_name, 4, 20)).
168+
p_dml_view_trigger_name IN VARCHAR2 DEFAULT NULL, -- If not null, the given name is used for the DML view trigger - you can use substitutions like #TABLE_NAME#, #TABLE_NAME_26# or #TABLE_NAME_4_20# (treated as substr(table_name, 4, 20)).
167169
p_enable_one_to_one_view IN BOOLEAN DEFAULT FALSE, -- If true, a 1:1 view with read only is generated - useful when you want to separate the tables into an own schema without direct user access.
168-
p_one_to_one_view_name IN VARCHAR2 DEFAULT NULL, -- If not null, the given name is used for the 1:1 view - you can use substitutions like #TABLE_NAME# or #TABLE_NAME_4_20# (treated as substr(table_name, 4, 20)).
169-
p_api_name IN VARCHAR2 DEFAULT NULL, -- If not null, the given name is used for the API - you can use substitutions like #TABLE_NAME# or #TABLE_NAME_4_20# (treated as substr(table_name, 4, 20)).
170+
p_one_to_one_view_name IN VARCHAR2 DEFAULT NULL, -- If not null, the given name is used for the 1:1 view - you can use substitutions like #TABLE_NAME#, #TABLE_NAME_26# or #TABLE_NAME_4_20# (treated as substr(table_name, 4, 20)).
171+
p_api_name IN VARCHAR2 DEFAULT NULL, -- If not null, the given name is used for the API - you can use substitutions like #TABLE_NAME#, #TABLE_NAME_26# or #TABLE_NAME_4_20# (treated as substr(table_name, 4, 20)).
170172
p_sequence_name IN VARCHAR2 DEFAULT NULL, -- If not null, the given name is used for the create_row methods - same substitutions like with API name possible.
171173
p_exclude_column_list IN VARCHAR2 DEFAULT NULL, -- If not null, the provided comma separated column names are excluded on inserts and updates (virtual columns are implicitly excluded).
172174
p_audit_column_mappings IN VARCHAR2 DEFAULT NULL, -- If not null, the provided comma separated column names are excluded and populated by the API (you don't need a trigger for update_by, update_on...).
@@ -214,10 +216,11 @@ FUNCTION get_code
214216
p_double_quote_names IN BOOLEAN DEFAULT TRUE, -- If true, object names (owner, table, columns) are placed in double quotes.
215217
p_default_bulk_limit IN INTEGER DEFAULT 1000, -- The default bulk size for the set based methods (create_rows, read_rows, update_rows)
216218
p_enable_dml_view IN BOOLEAN DEFAULT FALSE, -- If true, a view with an instead of trigger is generated, which simply calls the API methods - can be useful for low code frontends like APEX.
217-
p_dml_view_name IN VARCHAR2 DEFAULT NULL, -- If not null, the given name is used for the DML view - you can use substitutions like #TABLE_NAME# or #TABLE_NAME_4_20# (treated as substr(table_name, 4, 20)).
219+
p_dml_view_name IN VARCHAR2 DEFAULT NULL, -- If not null, the given name is used for the DML view - you can use substitutions like #TABLE_NAME# , #TABLE_NAME_26# or #TABLE_NAME_4_20# (treated as substr(table_name, 4, 20)).
220+
p_dml_view_trigger_name IN VARCHAR2 DEFAULT NULL, -- If not null, the given name is used for the DML view trigger - you can use substitutions like #TABLE_NAME#, #TABLE_NAME_26# or #TABLE_NAME_4_20# (treated as substr(table_name, 4, 20)).
218221
p_enable_one_to_one_view IN BOOLEAN DEFAULT FALSE, -- If true, a 1:1 view with read only is generated - useful when you want to separate the tables into an own schema without direct user access.
219-
p_one_to_one_view_name IN VARCHAR2 DEFAULT NULL, -- If not null, the given name is used for the 1:1 view - you can use substitutions like #TABLE_NAME# or #TABLE_NAME_4_20# (treated as substr(table_name, 4, 20)).
220-
p_api_name IN VARCHAR2 DEFAULT NULL, -- If not null, the given name is used for the API - you can use substitutions like #TABLE_NAME# or #TABLE_NAME_4_20# (treated as substr(table_name, 4, 20)).
222+
p_one_to_one_view_name IN VARCHAR2 DEFAULT NULL, -- If not null, the given name is used for the 1:1 view - you can use substitutions like #TABLE_NAME#, #TABLE_NAME_26# or #TABLE_NAME_4_20# (treated as substr(table_name, 4, 20)).
223+
p_api_name IN VARCHAR2 DEFAULT NULL, -- If not null, the given name is used for the API - you can use substitutions like #TABLE_NAME#, #TABLE_NAME_26# or #TABLE_NAME_4_20# (treated as substr(table_name, 4, 20)).
221224
p_sequence_name IN VARCHAR2 DEFAULT NULL, -- If not null, the given name is used for the create_row methods - same substitutions like with API name possible.
222225
p_exclude_column_list IN VARCHAR2 DEFAULT NULL, -- If not null, the provided comma separated column names are excluded on inserts and updates (virtual columns are implicitly excluded).
223226
p_audit_column_mappings IN VARCHAR2 DEFAULT NULL, -- If not null, the provided comma separated column names are excluded and populated by the API (you don't need a trigger for update_by, update_on...).

docs/changelog.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,15 @@ Please use for all comments, discussions, feature requests or bug reports the Gi
3939
- added: support for audit columns (parameters p_audit_column_mappings and p_audit_user_expression)
4040
- added: support for a row version column (parameter p_row_version_column_mapping)
4141
- added: support for a 1:1 view with read only (parameter p_enable_one_to_one_view)
42-
- added: support for naming the generated views (parameters p_dml_view_name and p_one_to_one_view_name)
42+
- added: support for naming all generated objects (parameters p_dml_view_name, p_dml_view_trigger_name and p_one_to_one_view_name)
4343
- added: double quoting of table and column names can now be configured (parameter p_double_quote_names, default true)
4444
- added: update function with return clause (mainly for use in create_or_update_row to prevent read row after update)
4545
- added: unit tests with utPLSQL (it will be a permanent task to improve the tests with every new feature or bugfix)
4646
- removed: support for a generic change log (parameter p_enable_generic_change_log - makes no sense anymore with bulk processing and multi column primary keys)
4747
- removed: prevent updates if columns do not differ (remove was needed to support all possible column types and for performance reasons)
4848
- removed: parameter p_reuse_existing_api_params (usage was was not logic, simply provide always your needed parameters and create scripts or a wrapper)
4949
- removed: procedure recreate_existing_apis (this was a parameterless procedure which reused the existing API parameters, you can still do this with the help of the pipelined function view_existing_apis)
50-
- fixed: identity columns are always hidden on create methods (is now handled correct and in the sense of an API)
50+
- fixed: identity columns are always hidden on create methods (is now handled correct and in the sense of a table API)
5151

5252
## 0.5.2 (2020-05-09)
5353

docs/parameters.md

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
- [p_default_bulk_limit (since v0.6.0)](#p_default_bulk_limit-since-v060)
3030
- [p_enable_dml_view (since v0.4.0)](#p_enable_dml_view-since-v040)
3131
- [p_dml_view_name (since v0.6.0)](#p_dml_view_name-since-v060)
32+
- [p_dml_view_trigger_name (since v0.6.0)](#p_dml_view_trigger_name-since-v060)
3233
- [p_enable_one_to_one_view (since v0.6.0)](#p_enable_one_to_one_view-since-v060)
3334
- [p_one_to_one_view_name (since v0.6.0)](#p_one_to_one_view_name-since-v060)
3435
- [p_api_name (since v0.5.0)](#p_api_name-since-v050)
@@ -137,11 +138,25 @@
137138

138139
- String (varchar2), default: null
139140
- If not null, the given name is used for the DML view
140-
- You can use substitutions - examples:
141+
- You can use the substitutions `#TABLE_NAME#`, `#COLUMN_PREFIX#` and `#PK_COLUMN#` (the first column on multicolumn primary keys)
142+
- Examples:
143+
- `#TABLE_NAME#` is substituted as `table_name`
141144
- `#TABLE_NAME_20#` is treated as `substr(table_name, 1, 20)`
142145
- `#TABLE_NAME_5_20#` is treated as `substr(table_name, 5, 20)`
143146
- `#TABLE_NAME_-20_20#` is treated as `substr(table_name, -20, 20)`
144-
- For table EMP and `p_dml_view_name => '#TABLE_NAME_26#_V'` you get `EMP_V`
147+
- For TABLE_NAME_WITH_29_CHARACTERS and `p_dml_view_name => '#TABLE_NAME_24#_DML_V'` you get `TABLE_NAME_WITH_29_CHARA_DML_V`
148+
149+
## p_dml_view_trigger_name (since v0.6.0)
150+
151+
- String (varchar2), default: null
152+
- If not null, the given name is used for the DML view trigger
153+
- You can use the substitutions `#TABLE_NAME#`, `#COLUMN_PREFIX#` and `#PK_COLUMN#` (the first column on multicolumn primary keys)
154+
- Examples:
155+
- `#TABLE_NAME#` is substituted as `table_name`
156+
- `#TABLE_NAME_20#` is treated as `substr(table_name, 1, 20)`
157+
- `#TABLE_NAME_5_20#` is treated as `substr(table_name, 5, 20)`
158+
- `#TABLE_NAME_-20_20#` is treated as `substr(table_name, -20, 20)`
159+
- For TABLE_NAME_WITH_29_CHARACTERS and `p_dml_view_trigger_name => '#TABLE_NAME_24#_IOIUD'` you get `TABLE_NAME_WITH_29_CHARA_IOIUD`
145160

146161
## p_enable_one_to_one_view (since v0.6.0)
147162

@@ -153,21 +168,25 @@
153168

154169
- String (varchar2), default: null
155170
- If not null, the given name is used for the 1:1 view
156-
- You can use substitutions - examples:
171+
- You can use the substitutions `#TABLE_NAME#`, `#COLUMN_PREFIX#` and `#PK_COLUMN#` (the first column on multicolumn primary keys)
172+
- Examples:
173+
- `#TABLE_NAME#` is substituted as `table_name`
157174
- `#TABLE_NAME_20#` is treated as `substr(table_name, 1, 20)`
158175
- `#TABLE_NAME_5_20#` is treated as `substr(table_name, 5, 20)`
159176
- `#TABLE_NAME_-20_20#` is treated as `substr(table_name, -20, 20)`
160-
- For table EMP and `p_one_to_one_view_name => '#TABLE_NAME_26#_V'` you get `EMP_V`
177+
- For TABLE_NAME_WITH_29_CHARACTERS and `p_one_to_one_view_name => '#TABLE_NAME_28#_V'` you get `TABLE_NAME_WITH_29_CHARACTER_V`
161178

162179
## p_api_name (since v0.5.0)
163180

164181
- String (varchar2), default: null
165182
- If not null, the given name is used for the API
166-
- You can use substitutions - examples:
183+
- You can use the substitutions `#TABLE_NAME#`, `#COLUMN_PREFIX#` and `#PK_COLUMN#` (the first column on multicolumn primary keys)
184+
- Examples:
185+
- `#TABLE_NAME#` is substituted as `table_name`
167186
- `#TABLE_NAME_20#` is treated as `substr(table_name, 1, 20)`
168187
- `#TABLE_NAME_5_20#` is treated as `substr(table_name, 5, 20)`
169188
- `#TABLE_NAME_-20_20#` is treated as `substr(table_name, -20, 20)`
170-
- For table EMP and `p_api_name => '#TABLE_NAME_26#_API'` you get `EMP_API`
189+
- For TABLE_NAME_WITH_29_CHARACTERS and `p_api_name => '#TABLE_NAME_26#_API'` you get `TABLE_NAME_WITH_29_CHARACT_API`
171190

172191
## p_sequence_name (since v0.2.0)
173192

0 commit comments

Comments
 (0)