@@ -971,7 +971,32 @@ describe(`Object references`, () => {
971
971
expect ( statement . type ) . toBe ( StatementType . With ) ;
972
972
973
973
const refs = statement . getObjectReferences ( ) ;
974
+ expect ( refs . length ) . toBe ( 3 ) ;
975
+
976
+ expect ( refs [ 0 ] . object . name ) . toBe ( `object_ownership` ) ;
977
+ expect ( refs [ 0 ] . object . schema ) . toBe ( `qsys2` ) ;
978
+
979
+ expect ( refs [ 1 ] . object . name ) . toBe ( `qsysobjs` ) ;
980
+ expect ( refs [ 1 ] . object . schema ) . toBeUndefined ( ) ;
981
+ expect ( refs [ 1 ] . alias ) . toBe ( `q` ) ;
982
+
983
+ expect ( refs [ 2 ] . object . name ) . toBe ( `object_statistics` ) ;
984
+ expect ( refs [ 2 ] . object . schema ) . toBe ( `qsys2` ) ;
985
+ expect ( refs [ 2 ] . alias ) . toBe ( `z` ) ;
974
986
} ) ;
987
+
988
+ test ( `Multiple UDTFs` , ( ) => {
989
+ const lines = [
990
+ `SELECT b.objlongschema, b.objname, b.objtype, b.objattribute, b.objcreated, b.objsize, b.objtext, b.days_used_count, b.last_used_timestamp,b.* FROM ` ,
991
+ ` TABLE (QSYS2.OBJECT_STATISTICS('*ALLUSRAVL ', '*LIB') ) as a, ` ,
992
+ ` TABLE (QSYS2.OBJECT_STATISTICS(a.objname, 'ALL') ) AS b` ,
993
+ `WHERE b.OBJOWNER = 'user-name'` ,
994
+ `ORDER BY b.OBJSIZE DESC` ,
995
+ `FETCH FIRST 100 ROWS ONLY;` ,
996
+ ] . join ( `\n` ) ;
997
+
998
+ const document = new Document ( lines ) ;
999
+ } )
975
1000
} ) ;
976
1001
977
1002
describe ( `Offset reference tests` , ( ) => {
@@ -1167,7 +1192,6 @@ describe(`PL body tests`, () => {
1167
1192
const refs = statement . getObjectReferences ( ) ;
1168
1193
const ctes = statement . getCTEReferences ( ) ;
1169
1194
1170
- console . log ( refs ) ;
1171
1195
expect ( refs . length ) . toBe ( 7 ) ;
1172
1196
expect ( refs [ 0 ] . object . name ) . toBe ( `shipments` ) ;
1173
1197
expect ( refs [ 0 ] . alias ) . toBe ( `s` ) ;
0 commit comments