@@ -103,7 +103,8 @@ export default class Schemas {
103
103
* Resolves to the following SQL types: SCHEMA, TABLE, VIEW, ALIAS, INDEX, FUNCTION and PROCEDURE
104
104
*/
105
105
static async resolveObjects (
106
- sqlObjects : ObjectReference [ ]
106
+ sqlObjects : ObjectReference [ ] ,
107
+ ignoreSystemTypes : string [ ] = [ ]
107
108
) : Promise < ResolvedSqlObject [ ] > {
108
109
let statements : string [ ] = [ ] ;
109
110
let parameters : BasicColumnType [ ] = [ ] ;
@@ -114,6 +115,13 @@ export default class Schemas {
114
115
115
116
// First, we use OBJECT_STATISTICS to resolve the object based on the library list.
116
117
// But, if the object is qualified with a schema, we need to use that schema to get the correct object.
118
+
119
+ let ignoreClause = `` ;
120
+ if ( ignoreSystemTypes . length > 0 ) {
121
+ ignoreSystemTypes = ignoreSystemTypes . map ( i => i . toUpperCase ( ) ) ;
122
+ ignoreClause = `where objtype not in (${ ignoreSystemTypes . map ( ( i ) => `?` ) . join ( `, ` ) } )` ;
123
+ }
124
+
117
125
for ( const obj of sqlObjects ) {
118
126
const cached = this . getCachedReference ( obj ) ;
119
127
if ( cached ) {
@@ -123,14 +131,14 @@ export default class Schemas {
123
131
124
132
if ( obj . schema ) {
125
133
statements . push (
126
- `${ BASE_RESOLVE_SELECT } from table(qsys2.object_statistics(?, '*ALL', object_name => ?))`
134
+ `${ BASE_RESOLVE_SELECT } from table(qsys2.object_statistics(?, '*ALL', object_name => ?)) ${ ignoreClause } `
127
135
) ;
128
- parameters . push ( obj . schema , obj . name ) ;
136
+ parameters . push ( obj . schema , obj . name , ... ignoreSystemTypes ) ;
129
137
} else {
130
138
statements . push (
131
- `${ BASE_RESOLVE_SELECT } from table(qsys2.object_statistics('*LIBL', '*ALL', object_name => ?))`
139
+ `${ BASE_RESOLVE_SELECT } from table(qsys2.object_statistics('*LIBL', '*ALL', object_name => ?)) ${ ignoreClause } `
132
140
) ;
133
- parameters . push ( obj . name ) ;
141
+ parameters . push ( obj . name , ... ignoreSystemTypes ) ;
134
142
}
135
143
}
136
144
0 commit comments