@@ -111,7 +111,7 @@ private Task FillMetaDataCollectionsAsync(IOBehavior ioBehavior, DataTable dataT
111
111
dataTable . Rows . Add ( "ResourceGroups" , 0 , 0 ) ;
112
112
dataTable . Rows . Add ( "Restrictions" , 0 , 0 ) ;
113
113
dataTable . Rows . Add ( "SchemaPrivileges" , 0 , 0 ) ;
114
- dataTable . Rows . Add ( "Tables" , 0 , 3 ) ;
114
+ dataTable . Rows . Add ( "Tables" , 4 , 3 ) ;
115
115
dataTable . Rows . Add ( "TableConstraints" , 0 , 3 ) ;
116
116
dataTable . Rows . Add ( "TablePrivileges" , 0 , 0 ) ;
117
117
dataTable . Rows . Add ( "TableSpaces" , 0 , 0 ) ;
@@ -599,6 +599,10 @@ private Task FillRestrictionsAsync(IOBehavior ioBehavior, DataTable dataTable, s
599
599
dataTable . Rows . Add ( "Columns" , "Schema" , "TABLE_SCHEMA" , 2 ) ;
600
600
dataTable . Rows . Add ( "Columns" , "Table" , "TABLE_NAME" , 3 ) ;
601
601
dataTable . Rows . Add ( "Columns" , "Column" , "COLUMN_NAME" , 4 ) ;
602
+ dataTable . Rows . Add ( "Tables" , "Catalog" , "TABLE_CATALOG" , 1 ) ;
603
+ dataTable . Rows . Add ( "Tables" , "Schema" , "TABLE_SCHEMA" , 2 ) ;
604
+ dataTable . Rows . Add ( "Tables" , "Table" , "TABLE_NAME" , 3 ) ;
605
+ dataTable . Rows . Add ( "Tables" , "TableType" , "TABLE_TYPE" , 4 ) ;
602
606
603
607
return Utility . CompletedTask ;
604
608
}
@@ -622,8 +626,8 @@ private async Task FillSchemaPrivilegesAsync(IOBehavior ioBehavior, DataTable da
622
626
623
627
private async Task FillTablesAsync ( IOBehavior ioBehavior , DataTable dataTable , string ? [ ] ? restrictionValues , CancellationToken cancellationToken )
624
628
{
625
- if ( restrictionValues is not null )
626
- throw new ArgumentException ( "restrictionValues is not supported for schema 'Tables'." , nameof ( restrictionValues ) ) ;
629
+ if ( restrictionValues is { Length : > 4 } )
630
+ throw new ArgumentException ( "More than 4 restrictionValues are not supported for schema 'Tables'." , nameof ( restrictionValues ) ) ;
627
631
628
632
dataTable . Columns . AddRange ( new DataColumn [ ]
629
633
{
@@ -650,7 +654,20 @@ private async Task FillTablesAsync(IOBehavior ioBehavior, DataTable dataTable, s
650
654
new ( "TABLE_COMMENT" , typeof ( string ) ) ,
651
655
} ) ;
652
656
653
- await FillDataTableAsync ( ioBehavior , dataTable , "TABLES" , null , cancellationToken ) . ConfigureAwait ( false ) ;
657
+ var columns = new List < KeyValuePair < string , string > > ( ) ;
658
+ if ( restrictionValues is not null )
659
+ {
660
+ if ( restrictionValues . Length > 0 && ! string . IsNullOrEmpty ( restrictionValues [ 0 ] ) )
661
+ columns . Add ( new ( "TABLE_CATALOG" , restrictionValues [ 0 ] ! ) ) ;
662
+ if ( restrictionValues . Length > 1 && ! string . IsNullOrEmpty ( restrictionValues [ 1 ] ) )
663
+ columns . Add ( new ( "TABLE_SCHEMA" , restrictionValues [ 1 ] ! ) ) ;
664
+ if ( restrictionValues . Length > 2 && ! string . IsNullOrEmpty ( restrictionValues [ 2 ] ) )
665
+ columns . Add ( new ( "TABLE_NAME" , restrictionValues [ 2 ] ! ) ) ;
666
+ if ( restrictionValues . Length > 3 && ! string . IsNullOrEmpty ( restrictionValues [ 3 ] ) )
667
+ columns . Add ( new ( "TABLE_TYPE" , restrictionValues [ 3 ] ! ) ) ;
668
+ }
669
+
670
+ await FillDataTableAsync ( ioBehavior , dataTable , "TABLES" , columns , cancellationToken ) . ConfigureAwait ( false ) ;
654
671
}
655
672
656
673
private async Task FillTableConstraintsAsync ( IOBehavior ioBehavior , DataTable dataTable , string ? [ ] ? restrictionValues , CancellationToken cancellationToken )
0 commit comments