Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/14/15 15:56:26 (9 years ago)
Author:
dglaser
Message:

#2429: Worked on the maintenance WebApp plugin:

  • Space Usage Page: Displays the number of rows and allocated disk space for every database table
  • Plugin Page: Shows unused plugins and provides functionality to delete all and specific plugins
  • FactTask Page: Allows to aggregate all Job Tasks to a single task for a given job or jobs within an selected time period
  • FactClientInfo Page: Allows to aggregate consecutive FactClientInfo entries with the same state and isallowedtocalculate flag
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HiveStatistics/sources/HeuristicLab.Services.Hive.DataAccess/3.3/Manager/PersistenceManager.cs

    r12691 r12761  
    2222using System;
    2323using System.Data.Linq;
     24using System.Linq;
    2425using System.Transactions;
    2526using HeuristicLab.Services.Hive.DataAccess.Daos;
    2627using HeuristicLab.Services.Hive.DataAccess.Daos.HiveStatistics;
     28using HeuristicLab.Services.Hive.DataAccess.Data;
    2729using HeuristicLab.Services.Hive.DataAccess.Interfaces;
    2830
     
    200202    #endregion
    201203
     204    // str.Remove(str.IndexOf(','));
     205    public TableInformation GetTableInformation(string table) {
     206      string query = string.Format("sp_spaceused '{0}', @updateusage='true'", table);
     207      var result = dataContext.ExecuteQuery<SqlServerTableInformation>(query).FirstOrDefault();
     208      if (result == null) return null;
     209      return new TableInformation {
     210        Name = result.Name,
     211        Rows = int.Parse(result.Rows.Remove(result.Rows.IndexOf(' '))),
     212        Reserved = int.Parse(result.Reserved.Remove(result.Reserved.IndexOf(' '))),
     213        Data = int.Parse(result.Data.Remove(result.Data.IndexOf(' '))),
     214        IndexSize = int.Parse(result.Index_Size.Remove(result.Index_Size.IndexOf(' '))),
     215        Unused = int.Parse(result.Unused.Remove(result.Unused.IndexOf(' ')))
     216      };
     217    }
     218
    202219    public void SubmitChanges() {
    203220      if (dataContext != null) {
     
    211228      //}
    212229    }
     230
     231    private class SqlServerTableInformation {
     232      public string Name { get; set; }
     233      public string Rows { get; set; }
     234      public string Reserved { get; set; }
     235      public string Data { get; set; }
     236      public string Index_Size { get; set; } // naming of sp_spaceused...
     237      public string Unused { get; set; }
     238    }
    213239  }
    214240}
Note: See TracChangeset for help on using the changeset viewer.