internal static void AddObjectVisibilityRestrictionIfApplicable(AdomdConnection connection, string requestType, ListDictionary restrictions) { if (AdomdUtils.ShouldAddObjectVisibilityRestriction(connection)) { string text; if (requestType == DimensionCollectionInternal.schemaName) { text = "DIMENSION_VISIBILITY"; } else if (requestType == HierarchyCollectionInternal.schemaName) { text = "HIERARCHY_VISIBILITY"; } else if (requestType == LevelCollectionInternal.schemaName) { text = "LEVEL_VISIBILITY"; } else if (requestType == MeasureCollectionInternal.schemaName) { text = "MEASURE_VISIBILITY"; } else if (requestType == "MDSCHEMA_PROPERTIES") { text = "PROPERTY_VISIBILITY"; } else { text = null; } if (text != null) { restrictions.Add(text, 3); } } }
internal void PopulateSelf() { if (this.connection == null) { throw new NotSupportedException(SR.NotSupportedWhenConnectionMissing); } AdomdUtils.CheckConnectionOpened(this.connection); if (!this.IsInitialized) { this.cacheTable = new DataTable(); this.cacheTable.Locale = CultureInfo.InvariantCulture; this.cacheTable.Columns.Add("ObjectColumn_ADOMDInternal$$", typeof(object)); } if (this.isNestedSchema) { ObjectMetadataCache.DiscoverNested(this.connection, this.requestType, this.restrictions, out this.cacheDataSet); this.cacheTable.Columns.Add("__RowIndex__", typeof(int)); object[] array = new object[2]; for (int i = 0; i < this.cacheDataSet.Tables[0].Rows.Count; i++) { array[0] = null; array[1] = i; this.cacheTable.Rows.Add(array); } } else { ObjectMetadataCache.Discover(this.connection, this.requestType, this.restrictions, this.cacheTable, !this.isInitialized); } this.cacheState = MetadataCacheState.UpToDate; this.isInitialized = true; }
private DataRow[] GetRows(DataRow parentRow, string filter) { string text; if (parentRow != null) { text = AdomdUtils.GetDataTableFilter(this.relationColumn, parentRow[this.relationColumn].ToString()); if (filter != null) { text = string.Concat(new string[] { "(", text, " and ", filter, ")" }); } } else { text = filter; } return(this.cacheTable.Select(text)); }
public Member Find(string index) { if (index == null) { throw new ArgumentNullException("index"); } if (!this.memberHierarchyDataTable.Columns.Contains("MEMBER_NAME")) { throw new NotSupportedException(); } string dataTableFilter = AdomdUtils.GetDataTableFilter("MEMBER_NAME", index); DataRow[] array = this.memberHierarchyDataTable.Select(dataTableFilter); Member result; if (array.Length > 0) { result = new Member(this.connection, array[0], this.parentLevel, this.parentMember, MemberOrigin.InternalMemberQuery, this.cubeName, null, -1, this.catalog, this.sessionId); } else { result = null; } return(result); }
public void FetchAllProperties() { if (!this.baseData.IsMetadata) { AdomdUtils.PopulateSymetry(this); this.propertyCollection = null; } }
public override bool Equals(object obj) { if (!this.IsFromCellSet) { return(AdomdUtils.Equals(this, obj as IMetadataObject)); } return(AdomdUtils.Equals(this, obj as ISubordinateObject)); }
void ICollection.CopyTo(Array array, int index) { AdomdUtils.CheckCopyToParameters(array, index, this.Count); for (int i = 0; i < this.Count; i++) { array.SetValue(this[i], index + i); } }
public override int GetHashCode() { if (!this.hashCodeCalculated) { this.hashCode = AdomdUtils.GetHashCode(this); this.hashCodeCalculated = true; } return(this.hashCode); }
internal CubeCollectionInternal(AdomdConnection connection) : base(connection) { ListDictionary restrictions = new ListDictionary(); AdomdUtils.AddCubeSourceRestrictionIfApplicable(connection, restrictions); ObjectMetadataCache objectCache = new ObjectMetadataCache(connection, InternalObjectType.InternalTypeCube, CubeCollectionInternal.schemaName, restrictions); base.Initialize(objectCache); }
internal void PopulateParentLevel() { if (this.Connection == null) { throw new NotSupportedException(SR.NotSupportedWhenConnectionMissing); } AdomdUtils.CheckConnectionOpened(this.Connection); string parentLevelUName = this.ParentLevelUName; this.parentLevel = (this.Connection.GetObjectData(SchemaObjectType.ObjectTypeLevel, this.baseData.CubeName, parentLevelUName) as Level); }
private static Hashtable GetNamesHash(DataTable table) { Hashtable hashtable = new Hashtable(StringComparer.OrdinalIgnoreCase); if (table == null) { return(hashtable); } AdomdUtils.FillNamesHashTable(table, hashtable); return(hashtable); }
private static Hashtable GetNamesHash(DataTable table) { Hashtable hashtable = new Hashtable(); if (table == null) { return(hashtable); } AdomdUtils.FillNamesHashTable(table, hashtable); return(hashtable); }
private static Hashtable GetNamesHash(DataTable table, int firstPropertyOffSet) { Hashtable hashtable = new Hashtable(); if (table == null) { return(hashtable); } AdomdUtils.FillPropertiesNamesHashTable(table, hashtable, firstPropertyOffSet); return(hashtable); }
public static string GetMemberQuery(string memberSet, string dimensionPropertiesClause, CubeDef cube) { string text = AdomdUtils.Enquote(cube.Name, "[", "]"); return(string.Format(CultureInfo.InvariantCulture, "SELECT {0} {1} ON 0, {{}} ON 1 FROM {2}", new object[] { memberSet, dimensionPropertiesClause, text })); }
internal DataRow FindObjectByName(string name, DataRow parentRow, string nameColumn) { this.PopulateCollection(); string dataTableFilter = AdomdUtils.GetDataTableFilter(nameColumn, name); DataRow[] filteredRows = this.objectCache.GetFilteredRows(parentRow, dataTableFilter); if (filteredRows.Length <= 0) { return(null); } return(filteredRows[0]); }
DataRow IMetadataCache.FindObjectByUniqueName(SchemaObjectType objectType, string nameUnique) { this.Populate((InternalObjectType)objectType); ObjectMetadataCache objectCache = this.GetObjectCache((InternalObjectType)objectType); string dataTableFilter = AdomdUtils.GetDataTableFilter(this.GetUniqueNameColumn((InternalObjectType)objectType), nameUnique); DataRow[] filteredRows = ((IObjectCache)objectCache).GetFilteredRows(null, dataTableFilter); if (filteredRows.Length <= 0) { return(null); } return(filteredRows[0]); }
private void CheckCanExecute() { if (this.connection == null) { throw new InvalidOperationException(SR.Command_ConnectionIsNotSet); } AdomdUtils.CheckConnectionOpened(this.connection); if (this.CommandText == null && this.CommandStream == null) { throw new InvalidOperationException(SR.Command_CommandTextCommandStreamNotSet); } if (this.CommandStream != null && this.CommandText != null) { throw new InvalidOperationException(SR.Command_CommandTextCommandStreamBothSet); } }
internal static void PopulateSymetry(IAdomdBaseObject iBaseObject) { if (iBaseObject.Connection == null) { throw new NotSupportedException(SR.NotSupportedWhenConnectionMissing); } AdomdUtils.CheckConnectionOpened(iBaseObject.Connection); if (iBaseObject.CubeName == null) { throw new NotSupportedException(SR.NotSupportedByProvider); } IAdomdBaseObject adomdBaseObject = (IAdomdBaseObject)iBaseObject.Connection.GetObjectData(iBaseObject.SchemaObjectType, iBaseObject.CubeName, iBaseObject.InternalUniqueName); iBaseObject.MetadataData = adomdBaseObject.MetadataData; iBaseObject.ParentObject = adomdBaseObject.ParentObject; iBaseObject.IsMetadata = true; }
internal static string GetDataTableFilter(string columnName, string columnValue) { if (columnValue == null) { return(string.Format(CultureInfo.InvariantCulture, "( {0} is NULL )", new object[] { columnName })); } string text = AdomdUtils.Enquote(columnValue, "'", "'"); return(string.Format(CultureInfo.InvariantCulture, "( {0} = {1} )", new object[] { columnName, text })); }
internal CubeMetadataCache(AdomdConnection connection, CubeDef parentCube) { this.msgDelegate = new AdomdUtils.GetInvalidatedMessageDelegate(this.GetCubesUpdatedMessage); this.connection = connection; this.parentCube = parentCube; this.cacheState = MetadataCacheState.UpToDate; this.cacheDataset = new DataSet(); this.cacheDataset.Locale = CultureInfo.InvariantCulture; this.restrictions = new ListDictionary(); this.restrictions.Add(CubeCollectionInternal.cubeNameRest, parentCube.Name); AdomdUtils.AddCubeSourceRestrictionIfApplicable(this.connection, this.restrictions); int count = CubeMetadataCache.internalTypeMap.Count; this.objectMetadataCaches = new ObjectMetadataCache[count]; bool flag = AdomdUtils.ShouldAddObjectVisibilityRestriction(this.connection); for (int i = 0; i < count; i++) { ListDictionary destinationRestrictions; if (flag || CubeMetadataCache.SchemaRowsetsData[i].HasAdditionalRestrictions) { destinationRestrictions = new ListDictionary(); AdomdUtils.CopyRestrictions(this.restrictions, destinationRestrictions); if (CubeMetadataCache.SchemaRowsetsData[i].HasAdditionalRestrictions) { CubeMetadataCache.AddSpecificRestrictions(CubeMetadataCache.SchemaRowsetsData[i], destinationRestrictions); } if (flag) { AdomdUtils.AddObjectVisibilityRestrictionIfApplicable(this.connection, CubeMetadataCache.SchemaRowsetsData[i].RequestType, destinationRestrictions); } } else { destinationRestrictions = this.restrictions; } this.objectMetadataCaches[i] = new ObjectMetadataCache(this, connection, CubeMetadataCache.SchemaRowsetsData[i], destinationRestrictions); } this.lastCacheValidationTime = parentCube.PopulatedTime; this.cubeInfoTable = new DataTable(); this.cubeInfoTable.Locale = CultureInfo.InvariantCulture; this.cubeInfoTable = ((DataRow)((IAdomdBaseObject)parentCube).MetadataData).Table.Clone(); this.originalTimeColumn = ((DataRow)((IAdomdBaseObject)parentCube).MetadataData).Table.Columns[CubeDef.lastSchemaUpdateColumn]; this.currentTimeColumn = this.cubeInfoTable.Columns[CubeDef.lastSchemaUpdateColumn]; }
internal static void FillPropertiesNamesHashTable(DataTable table, Hashtable hash, int startColumn) { if (table == null || hash == null) { return; } hash.Clear(); for (int i = startColumn; i < table.Columns.Count; i++) { DataColumn dataColumn = table.Columns[i]; if (!dataColumn.ExtendedProperties.ContainsKey("MemberPropertyUnqualifiedName")) { dataColumn.ExtendedProperties["MemberPropertyUnqualifiedName"] = AdomdUtils.UnQualifyPropertyName(dataColumn.Caption); } string key = dataColumn.ExtendedProperties["MemberPropertyUnqualifiedName"] as string; if (hash[key] == null) { hash[key] = i; } } }
private MemberCollection ExecuteMembersQuery(string memberMdxQuery, Level parentLevel, Member parentMember, int memberAxisPosition, int memberHierarhcyPosition) { if (memberAxisPosition < 0) { throw new ArgumentOutOfRangeException("memberAxisPosition"); } if (memberHierarhcyPosition < 0) { throw new ArgumentOutOfRangeException("memberHierarhcyPosition"); } AdomdConnection connection = this.Connection; if (connection == null) { throw new NotSupportedException(SR.NotSupportedWhenConnectionMissing); } AdomdUtils.CheckConnectionOpened(connection); AdomdCommand adomdCommand = new AdomdCommand(memberMdxQuery, connection); CellSet cellSet = adomdCommand.ExecuteCellSet(); if (memberAxisPosition >= cellSet.Axes.Count) { throw new ArgumentOutOfRangeException("memberAxisPosition"); } Axis axis = cellSet.Axes[memberAxisPosition]; IDSFDataSet axisDataset = axis.Set.AxisDataset; DataTable memberHierarchyDataTable = null; if (memberHierarhcyPosition != 0 || axisDataset.Count != 0) { if (memberHierarhcyPosition >= axisDataset.Count) { throw new ArgumentOutOfRangeException("memberHierarhcyPosition"); } memberHierarchyDataTable = axisDataset[memberHierarhcyPosition]; } return(new MemberCollection(connection, memberHierarchyDataTable, this.Name, parentLevel, parentMember)); }
internal static void FillNamesHashTable(DataTable table, Hashtable hash) { AdomdUtils.FillNamesHashTable(table, hash, 0); }
private static string EnquoteMdxString(string stringValue) { return(AdomdUtils.Enquote(stringValue, "\"", "\"")); }
public override bool Equals(object obj) { return(AdomdUtils.Equals(this, obj as IMetadataObject)); }
internal object InternalGetSchemaObject(SchemaObjectType schemaObjectType, string uniqueName, bool retryUniqueName) { DataRow dataRow; if (SchemaObjectType.ObjectTypeMember == schemaObjectType) { ListDictionary listDictionary = new ListDictionary(); listDictionary.Add(CubeCollectionInternal.cubeNameRest, this.Name); AdomdUtils.AddCubeSourceRestrictionIfApplicable(this.Connection, listDictionary); string requestType = "MDSCHEMA_MEMBERS"; string key = "MEMBER_UNIQUE_NAME"; listDictionary.Add(key, uniqueName); AdomdUtils.AddMemberBinaryRestrictionIfApplicable(this.Connection, listDictionary); DataRowCollection rows = AdomdUtils.GetRows(this.Connection, requestType, listDictionary); if (rows.Count != 1) { throw new ArgumentException(SR.Indexer_ObjectNotFound(uniqueName), "uniqueName"); } dataRow = rows[0]; } else { dataRow = this.metadataCache.FindObjectByUniqueName(schemaObjectType, uniqueName); if (dataRow == null && retryUniqueName) { ListDictionary listDictionary2 = new ListDictionary(); listDictionary2.Add(CubeCollectionInternal.cubeNameRest, this.Name); AdomdUtils.AddCubeSourceRestrictionIfApplicable(this.Connection, listDictionary2); string schemaName; string text; switch (schemaObjectType) { case SchemaObjectType.ObjectTypeDimension: schemaName = DimensionCollectionInternal.schemaName; text = DimensionCollectionInternal.dimUNameRest; goto IL_16D; case SchemaObjectType.ObjectTypeHierarchy: schemaName = HierarchyCollectionInternal.schemaName; text = HierarchyCollectionInternal.hierUNameRest; goto IL_16D; case SchemaObjectType.ObjectTypeLevel: schemaName = LevelCollectionInternal.schemaName; text = LevelCollectionInternal.levelUNameRest; goto IL_16D; case SchemaObjectType.ObjectTypeMember: case (SchemaObjectType)5: break; case SchemaObjectType.ObjectTypeMeasure: schemaName = MeasureCollectionInternal.schemaName; text = Measure.uniqueNameColumn; goto IL_16D; case SchemaObjectType.ObjectTypeKpi: schemaName = KpiCollectionInternal.schemaName; text = Kpi.kpiNameColumn; goto IL_16D; default: if (schemaObjectType == SchemaObjectType.ObjectTypeNamedSet) { schemaName = NamedSetCollectionInternal.schemaName; text = "SET_NAME"; goto IL_16D; } break; } throw new ArgumentOutOfRangeException("schemaObjectType"); IL_16D: listDictionary2.Add(text, uniqueName); AdomdUtils.AddObjectVisibilityRestrictionIfApplicable(this.Connection, schemaName, listDictionary2); DataRowCollection rows2 = AdomdUtils.GetRows(this.Connection, schemaName, listDictionary2); if (rows2.Count > 0) { uniqueName = (rows2[0][text] as string); if (uniqueName != null) { dataRow = this.metadataCache.FindObjectByUniqueName(schemaObjectType, uniqueName); } } } } if (dataRow == null) { throw new ArgumentException(SR.Indexer_ObjectNotFound(uniqueName), "uniqueName"); } switch (schemaObjectType) { case SchemaObjectType.ObjectTypeDimension: { object result = DimensionCollectionInternal.GetDimensionByRow(this.Connection, dataRow, this, this.baseData.Catalog, this.baseData.SessionID); return(result); } case SchemaObjectType.ObjectTypeHierarchy: { Dimension parentDimension = (Dimension)this.InternalGetSchemaObject(SchemaObjectType.ObjectTypeDimension, dataRow[Dimension.uniqueNameColumn].ToString()); object result = HierarchyCollectionInternal.GetHiearchyByRow(this.Connection, dataRow, parentDimension, this.baseData.Catalog, this.baseData.SessionID); return(result); } case SchemaObjectType.ObjectTypeLevel: { string uniqueName2 = dataRow[Hierarchy.uniqueNameColumn].ToString(); Hierarchy parentHierarchy = (Hierarchy)this.InternalGetSchemaObject(SchemaObjectType.ObjectTypeHierarchy, uniqueName2); object result = LevelCollectionInternal.GetLevelByRow(this.Connection, dataRow, parentHierarchy, this.baseData.Catalog, this.baseData.SessionID); return(result); } case SchemaObjectType.ObjectTypeMember: { object result = new Member(this.Connection, dataRow, null, null, MemberOrigin.Metadata, this.Name, null, -1, this.baseData.Catalog, this.baseData.SessionID); return(result); } case (SchemaObjectType)5: break; case SchemaObjectType.ObjectTypeMeasure: { object result = MeasureCollectionInternal.GetMeasureByRow(this.Connection, dataRow, this, this.baseData.Catalog, this.baseData.SessionID); return(result); } case SchemaObjectType.ObjectTypeKpi: { object result = KpiCollectionInternal.GetKpiByRow(this.Connection, dataRow, this, this.baseData.Catalog, this.baseData.SessionID); return(result); } default: if (schemaObjectType == SchemaObjectType.ObjectTypeNamedSet) { object result = NamedSetCollectionInternal.GetNamedSetByRow(this.Connection, dataRow, this, this.baseData.Catalog, this.baseData.SessionID); return(result); } break; } throw new ArgumentOutOfRangeException("schemaObjectType"); }
private void EnsureValid() { AdomdUtils.EnsureCacheNotInvalid(this.cacheState, this.msgDelegate); }
private void EnsureNotAbandoned() { AdomdUtils.EnsureCacheNotAbandoned(this.cacheState); }
public override bool Equals(object obj) { return(AdomdUtils.Equals(this, obj as ISubordinateObject)); }