Skip to content

Commit 1db2c06

Browse files
committed
add parameters p_dml_view_name and p_one_to_one_view_name
1 parent 20821f7 commit 1db2c06

File tree

9 files changed

+264
-58
lines changed

9 files changed

+264
-58
lines changed

README.md

Lines changed: 10 additions & 4 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.32';
82+
c_generator_version CONSTANT VARCHAR2(10 CHAR) := '0.5.2.33';
8383
```
8484

8585

@@ -114,8 +114,10 @@ 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)).
117118
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.
118-
p_api_name IN VARCHAR2 DEFAULT NULL, -- If not null, the given name is used for the API - you can use substitution like #TABLE_NAME_4_20# (treated as substr(4,20)).
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)).
119121
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.
120122
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).
121123
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...).
@@ -161,8 +163,10 @@ FUNCTION compile_api_and_get_code
161163
p_double_quote_names IN BOOLEAN DEFAULT TRUE, -- If true, object names (owner, table, columns) are placed in double quotes.
162164
p_default_bulk_limit IN INTEGER DEFAULT 1000, -- The default bulk size for the set based methods (create_rows, read_rows, update_rows)
163165
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)).
164167
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.
165-
p_api_name IN VARCHAR2 DEFAULT NULL, -- If not null, the given name is used for the API - you can use substitution like #TABLE_NAME_4_20# (treated as substr(4,20)).
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)).
166170
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.
167171
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).
168172
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...).
@@ -210,8 +214,10 @@ FUNCTION get_code
210214
p_double_quote_names IN BOOLEAN DEFAULT TRUE, -- If true, object names (owner, table, columns) are placed in double quotes.
211215
p_default_bulk_limit IN INTEGER DEFAULT 1000, -- The default bulk size for the set based methods (create_rows, read_rows, update_rows)
212216
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)).
213218
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.
214-
p_api_name IN VARCHAR2 DEFAULT NULL, -- If not null, the given name is used for the API - you can use substitution like #TABLE_NAME_4_20# (treated as substr(4,20)).
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)).
215221
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.
216222
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).
217223
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: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ 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)
4243
- added: double quoting of table and column names can now be configured (parameter p_double_quote_names, default true)
4344
- added: update function with return clause (mainly for use in create_or_update_row to prevent read row after update)
4445
- added: unit tests with utPLSQL (it will be a permanent task to improve the tests with every new feature or bugfix)

docs/parameters.md

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@
2828
- [p_double_quote_names (since v0.6.0)](#p_double_quote_names-since-v060)
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)
31+
- [p_dml_view_name (since v0.6.0)](#p_dml_view_name-since-v060)
3132
- [p_enable_one_to_one_view (since v0.6.0)](#p_enable_one_to_one_view-since-v060)
33+
- [p_one_to_one_view_name (since v0.6.0)](#p_one_to_one_view_name-since-v060)
3234
- [p_api_name (since v0.5.0)](#p_api_name-since-v050)
3335
- [p_sequence_name (since v0.2.0)](#p_sequence_name-since-v020)
3436
- [p_exclude_column_list (since v0.5.0)](#p_exclude_column_list-since-v050)
@@ -43,7 +45,7 @@
4345

4446
## p_table_name (since v0.0.0 ;-)
4547

46-
- String (all_objects.object_name%TYPE), mandatory
48+
- String (varchar2), mandatory
4749
- The table for which an API should be generated
4850

4951
## p_owner (since v0.5.0)
@@ -131,25 +133,45 @@
131133
- If true, a view trigger named `#TABLE_NAME#_IOIUD` is created to handle DML operations on the view
132134
- If false, view and trigger are NOT generated
133135

136+
## p_dml_view_name (since v0.6.0)
137+
138+
- String (varchar2), default: null
139+
- If not null, the given name is used for the DML view
140+
- You can use substitutions - examples:
141+
- `#TABLE_NAME_20#` is treated as `substr(table_name, 1, 20)`
142+
- `#TABLE_NAME_5_20#` is treated as `substr(table_name, 5, 20)`
143+
- `#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`
145+
134146
## p_enable_one_to_one_view (since v0.6.0)
135147

136148
- Boolean, default: false
137149
- If true, a 1:1 view with read only is generated
138150
- Can be useful when you want to separate the tables into an own schema without direct user access
139151

152+
## p_one_to_one_view_name (since v0.6.0)
153+
154+
- String (varchar2), default: null
155+
- If not null, the given name is used for the 1:1 view
156+
- You can use substitutions - examples:
157+
- `#TABLE_NAME_20#` is treated as `substr(table_name, 1, 20)`
158+
- `#TABLE_NAME_5_20#` is treated as `substr(table_name, 5, 20)`
159+
- `#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`
161+
140162
## p_api_name (since v0.5.0)
141163

142-
- String (all_objects.object_name%TYPE), default: null
164+
- String (varchar2), default: null
143165
- If not null, the given name is used for the API
144166
- You can use substitutions - examples:
145-
- `#TABLE_NAME_20#` is treated as `substr(table_name,1,20)`
146-
- `#TABLE_NAME_5_20#` is treated as `substr(table_name,5,20)`
147-
- `#TABLE_NAME_-20_20#` is treated as `substr(table_name,-20,20)`
167+
- `#TABLE_NAME_20#` is treated as `substr(table_name, 1, 20)`
168+
- `#TABLE_NAME_5_20#` is treated as `substr(table_name, 5, 20)`
169+
- `#TABLE_NAME_-20_20#` is treated as `substr(table_name, -20, 20)`
148170
- For table EMP and `p_api_name => '#TABLE_NAME_26#_API'` you get `EMP_API`
149171

150172
## p_sequence_name (since v0.2.0)
151173

152-
- String (all_objects.object_name%TYPE), default: null
174+
- String (varchar2), default: null
153175
- If a sequence name is given here, then the resulting API is taken the ID for the create_row methods and you don't need to create a trigger for your table only for the sequence handling
154176
- you can use the following substitution Strings, the generator is replacing this at runtime: `#TABLE_NAME_24#`, `#TABLE_NAME_26#`, `#TABLE_NAME_28#`, `#PK_COLUMN_26#`, `#PK_COLUMN_28#`, `#COLUMN_PREFIX#`
155177
- Example 1: `#TABLE_NAME_26#_SEQ`

0 commit comments

Comments
 (0)