/// <summary> /// Deletes the rdmp metadata objects (but not the actual <see cref="BulkDataTable"/>) /// </summary> public void DeleteCatalogue() { var creds = (DataAccessCredentials)tableInfo.GetCredentialsIfExists(DataAccessContext.InternalDataProcessing); if (tableInfo.Exists()) { tableInfo.DeleteInDatabase(); } if (creds != null) { try { creds.DeleteInDatabase(); } catch (CredentialsInUseException e) { Console.WriteLine("Ignored Potential Exception:" + e); } } if (catalogue.Exists()) { catalogue.DeleteInDatabase(); } }
private void ConfigureCatalogueExtractabilityUI_FormClosing(object sender, FormClosingEventArgs e) { if (!_choicesFinalised) { if (_importedNewTable) { var confirm = MessageBox.Show("The database table was created as part of this import. Do you want to keep that?", "Confirm", MessageBoxButtons.YesNoCancel); if (confirm != DialogResult.Cancel) { DialogResult = DialogResult.Cancel; _catalogue.DeleteInDatabase(); _catalogue = null; if (confirm == DialogResult.No) { _tableInfo.DeleteInDatabase(); _tableInfo = null; if (TableCreated != null && TableCreated.Exists()) { TableCreated.Drop(); } } else { Activator.Publish(TableInfoCreated); } } else { e.Cancel = true; } } else { if (MessageBox.Show( "Are you sure you want to Cancel?", "Confirm", MessageBoxButtons.YesNo) == DialogResult.Yes) { DialogResult = DialogResult.Cancel; _catalogue.DeleteInDatabase(); _catalogue = null; } else { e.Cancel = true; } } } else { if (CatalogueCreatedIfAny != null) { Activator.Publish(CatalogueCreatedIfAny); } } }
public void Destroy() { var credentials = (DataAccessCredentials)TableInfoCreated.GetCredentialsIfExists(DataAccessContext.InternalDataProcessing); TableInfoCreated.DeleteInDatabase(); if (credentials != null) { credentials.DeleteInDatabase(); } Cata.DeleteInDatabase(); }
public void EndToEndTest() { var cohortDatabaseNameWillBe = TestDatabaseNames.GetConsistentName("TbvCohort"); _discoveredCohortDatabase = DiscoveredServerICanCreateRandomDatabasesAndTablesOn.ExpectDatabase(cohortDatabaseNameWillBe); //cleanup if (_discoveredCohortDatabase.Exists()) { _discoveredCohortDatabase.Drop(); } //create a normal catalogue CreateANormalCatalogue(); //create a cohort database using wizard CreateNewCohortDatabaseWizard cohortDatabaseWizard = new CreateNewCohortDatabaseWizard(_discoveredCohortDatabase, CatalogueRepository, DataExportRepository, false); _externalCohortTable = cohortDatabaseWizard.CreateDatabase( new PrivateIdentifierPrototype(_nonTvfExtractionIdentifier) , new ThrowImmediatelyCheckNotifier()); //create a table valued function CreateTvfCatalogue(cohortDatabaseNameWillBe); //Test 1 TestThatQueryBuilderWithoutParametersBeingSetThrowsQueryBuildingException(); PopulateCohortDatabaseWithRecordsFromNonTvfCatalogue(); //Test 2 TestWithParameterValueThatRowsAreReturned(); //Test 3 TestUsingTvfForAggregates(); //Test 4 TestAddingTvfToCIC(); //Test 5 TestDataExportOfTvf(); //tear down DataExportRepository.GetAllObjects <ExtractableCohort>().Single().DeleteInDatabase(); _externalCohortTable.DeleteInDatabase(); _database.ExpectTable("NonTVFTable").Drop(); _database.ExpectTableValuedFunction("GetTopXRandom").Drop(); //delete global parameter ((AnyTableSqlParameter)_aggregate.GetAllParameters().Single()).DeleteInDatabase(); //delete aggregate _aggregate.DeleteInDatabase(); ((AnyTableSqlParameter)_cicAggregate.GetAllParameters().Single()).DeleteInDatabase(); //delete aggregate _cicAggregate.DeleteInDatabase(); //get rid of the cohort identification configuration _cic.DeleteInDatabase(); _pipe.DeleteInDatabase(); //get rid of the cohort database _discoveredCohortDatabase.Drop(); _nonTvfCatalogue.DeleteInDatabase(); _nonTvfTableInfo.DeleteInDatabase(); _tvfCatalogue.DeleteInDatabase(); _tvfTableInfo.DeleteInDatabase(); }