public void PrepareComputeTableStatistics(Context context, TableReference tr, out string connectionString, out string sql) { // Assign a database server to the query // TODO: maybe make this function generic // TODO: check this part to use appropriate server and database var sm = GetSchemaManager(false); var ds = sm.Datasets[tr.DatasetName]; if (ds is GraywulfDataset && !((GraywulfDataset)ds).IsSpecificInstanceRequired) { var gds = (GraywulfDataset)ds; var dd = new DatabaseDefinition(context); dd.Guid = gds.DatabaseDefinition.Guid; dd.Load(); // Get a server from the scheduler var si = new ServerInstance(Context); si.Guid = Scheduler.GetNextServerInstance(new Guid[] { dd.Guid }, StatDatabaseVersionName, null); si.Load(); connectionString = si.GetConnectionString().ConnectionString; SubstituteDatabaseName(tr, si.Guid, StatDatabaseVersionName); tr.DatabaseObject = null; } else { // Run it on the specific database connectionString = ds.ConnectionString; } // Generate statistics query sql = CodeGenerator.GenerateTableStatisticsQuery(tr); }
protected void Page_Load(object sender, EventArgs e) { item = new DatabaseDefinition(RegistryContext); item.Guid = new Guid(Request.QueryString["guid"]); item.Load(); if (!IsPostBack) { SliceCount2.Text = item.SliceCount.ToString(); PartitionCount2.Text = item.PartitionCount.ToString(); PartitionRangeType.SelectedValue = item.PartitionRangeType.ToString(); } sliceCount = int.Parse(SliceCount2.Text); partitionCount = int.Parse(PartitionCount2.Text); GenerateTable(); if (!IsPostBack) { GenerateDefaultData(); } }
protected void Page_Load(object sender, EventArgs e) { item = new DatabaseDefinition(RegistryContext); item.Guid = new Guid(Request.QueryString["guid"]); item.Load(); item.LoadDatabaseVersions(false); databaseVersions = new List <DatabaseVersion>(item.DatabaseVersions.Values); if (!IsPostBack) { RefreshDatabaseVersionList(); } // Load currently selected database version databaseVersion = new DatabaseVersion(RegistryContext); databaseVersion.Guid = new Guid(databaseVersionList.SelectedValue); databaseVersion.Load(); // Load server instances EntityFactory ef = new EntityFactory(RegistryContext); serverInstances = new List <ServerInstance>(ef.FindAll <ServerInstance>() .Where(i => i.ServerVersionReference.Guid == databaseVersion.ServerVersionReference.Guid) .OrderBy(i => i.Machine.Number)); // Load slices item.LoadSlices(false); slices = new List <Slice>(item.Slices.Values); if (!IsPostBack) { UpdateForm(); } GenerateTable(); }