1
1
2
- using System ;
2
+ using System ;
3
3
using System . Data ;
4
4
using System . Diagnostics ;
5
5
using System . Globalization ;
@@ -399,7 +399,7 @@ select count(t_object.Object_Type) as ['Count'], t_object.Object_Type as ['Measu
399
399
400
400
#region process result table and calculate Issue number
401
401
402
-
402
+
403
403
404
404
405
405
#endregion
@@ -421,7 +421,42 @@ select count(t_object.Object_Type) as ['Count'], t_object.Object_Type as ['Measu
421
421
return result ;
422
422
}
423
423
424
+ internal static Issue CheckTableSize ( string model )
425
+ {
426
+ #region get result table
427
+
428
+ const string statisticSql = @"SELECT name ,SUM(pgsize)/1024 table_size FROM 'dbstat' GROUP BY name ORDER BY table_size desc;" ;
429
+
430
+ var resultTable = ModelAccess . RunSql ( statisticSql ) ;
431
+ resultTable . DefaultView . Sort = "table_size" ;
432
+
433
+
434
+ Console . WriteLine ( ToMD ( resultTable , header : true ) ) ;
435
+
436
+ #endregion
437
+
438
+
439
+ #region process result table and calculate Issue number
440
+
441
+
442
+ #endregion
443
+
444
+ #region set Issue Level
445
+
446
+ Issue result = new Issue ( ) ;
447
+
448
+ result . Level = IssueLevel . Information ;
449
+ result . Title = "Table Statistics" ;
450
+
451
+
452
+
453
+ result . Detail = ToMD ( resultTable . DefaultView . ToTable ( ) , header : true ) ;
424
454
455
+
456
+ #endregion
457
+
458
+ return result ;
459
+ }
425
460
private static string ToMD ( DataTable t , bool header )
426
461
{
427
462
@@ -440,8 +475,8 @@ private static string ToMD(DataTable t, bool header)
440
475
{
441
476
442
477
sb . Append ( "|" ) ;
443
- sb . Append ( c . ColumnName . Replace ( "'" , "" ) ) ;
444
-
478
+ sb . Append ( c . ColumnName . Replace ( "'" , "" ) ) ;
479
+
445
480
}
446
481
sb . Append ( "|" ) ;
447
482
sb . Append ( Environment . NewLine ) ;
@@ -466,7 +501,7 @@ private static string ToMD(DataTable t, bool header)
466
501
467
502
sb . Append ( "|" ) ;
468
503
sb . Append ( item ) ;
469
-
504
+
470
505
}
471
506
sb . Append ( "|" ) ;
472
507
sb . Append ( Environment . NewLine ) ;
@@ -477,6 +512,7 @@ private static string ToMD(DataTable t, bool header)
477
512
return sb . ToString ( ) ;
478
513
479
514
}
515
+
480
516
}
481
517
}
482
518
0 commit comments