private string GetSql(ICatalogue mainCata) { mainCata.ClearAllInjections(); var qb = new QueryBuilder(null, null); qb.AddColumnRange(mainCata.GetAllExtractionInformation(ExtractionCategory.Any)); return(qb.SQL); }
/// <summary> /// Creates a new virtual column description for for a column in the dataset (<paramref name="parent"/>) supplied with the given Name. /// <para><remarks>You should next choose which <see cref="ColumnInfo"/> powers it and optionally create an <see cref="ExtractionInformation"/> to /// make the column extractable</remarks></para> /// </summary> public CatalogueItem(ICatalogueRepository repository, ICatalogue parent, string name) { repository.InsertAndHydrate(this, new Dictionary <string, object> { { "Name", name }, { "Catalogue_ID", parent.ID } }); ClearAllInjections(); parent.ClearAllInjections(); }
/// <summary> /// Change which column is the linkage identifier in a <see cref="Catalogue"/> either at a global level or for a specific <paramref name="inConfiguration"/> /// </summary> /// <param name="activator"></param> /// <param name="catalogue"></param> /// <param name="inConfiguration"></param> /// <param name="column"></param> public ExecuteCommandSetExtractionIdentifier(IBasicActivateItems activator, [DemandsInitialization("The dataset you want to change the extraction identifier for")] ICatalogue catalogue, [DemandsInitialization("Optional - The specific extraction you want the change made in or Null for the Catalogue itself (will affect all future extractions)")] IExtractionConfiguration inConfiguration, [DemandsInitialization("Optional - The Column name(s) you want to select as the new linkage identifier(s). Comma seperate multiple entries if needed")] string column) : base(activator) { _catalogue = catalogue; _inConfiguration = inConfiguration; _catalogue.ClearAllInjections(); if (inConfiguration != null) { var allEds = inConfiguration.GetAllExtractableDataSets(); var eds = allEds.FirstOrDefault(sds => sds.Catalogue_ID == _catalogue.ID); if (eds == null) { SetImpossible($"Catalogue '{_catalogue}' is not part of ExtractionConfiguration '{inConfiguration}'"); return; } _selectedDataSetColumns = inConfiguration.GetAllExtractableColumnsFor(eds); if (_selectedDataSetColumns.Length == 0) { SetImpossible($"Catalogue '{_catalogue}' in '{inConfiguration}' does not have any extractable columns"); return; } _alreadyMarkedInConfiguration = _selectedDataSetColumns.Where(ei => ei.IsExtractionIdentifier).ToArray(); } else { _extractionInformations = _catalogue.GetAllExtractionInformation(ExtractionCategory.Any); if (_extractionInformations.Length == 0) { SetImpossible("Catalogue does not have any extractable columns"); return; } _alreadyMarked = _extractionInformations.Where(ei => ei.IsExtractionIdentifier).ToArray(); } if (!string.IsNullOrWhiteSpace(column)) { toPick = column.Split(',', StringSplitOptions.RemoveEmptyEntries); } }