Beispiel #1
0
 public OracleSpecialTableReference(OracleReferenceContainer referenceContainer, ReferenceType referenceType, IEnumerable <OracleSelectListColumn> columns, StatementGrammarNode columnsClause)
     : base(referenceType)
 {
     referenceContainer.ObjectReferences.Add(this);
     Container         = referenceContainer;
     ColumnDefinitions = columns.ToArray();
     ColumnsClause     = columnsClause;
 }
Beispiel #2
0
        public OracleSqlModelReference(OracleStatementSemanticModel semanticModel, IReadOnlyList <OracleSelectListColumn> columns, IEnumerable <OracleDataObjectReference> sourceReferences, StatementGrammarNode measureExpressionList)
            : base(ReferenceType.SqlModel)
        {
            ColumnDefinitions = columns;

            MeasureExpressionList = measureExpressionList;

            SourceReferenceContainer = new OracleReferenceContainer(semanticModel);
            foreach (var column in columns)
            {
                TransferReferences(column.ColumnReferences, SourceReferenceContainer.ColumnReferences);
                TransferReferences(column.ProgramReferences, SourceReferenceContainer.ProgramReferences);
                TransferReferences(column.TypeReferences, SourceReferenceContainer.TypeReferences);
            }

            SourceReferenceContainer.ObjectReferences.AddRange(sourceReferences);

            DimensionReferenceContainer = new OracleReferenceContainer(semanticModel);
            MeasuresReferenceContainer  = new OracleReferenceContainer(semanticModel);

            ChildContainers = new[] { SourceReferenceContainer, DimensionReferenceContainer, MeasuresReferenceContainer };
        }
Beispiel #3
0
		public OraclePivotTableReference(OracleStatementSemanticModel semanticModel, OracleDataObjectReference sourceReference, StatementGrammarNode pivotClause)
			: base(ReferenceType.PivotTable)
		{
			foreach (var sourceColumn in sourceReference.QueryBlocks.SelectMany(qb => qb.Columns).Where(c => !c.IsAsterisk))
			{
				sourceColumn.RegisterOuterReference();
			}

			PivotClause = pivotClause;
			SourceReference = sourceReference;

			RootNode = sourceReference.RootNode;
			var innerTableReferenceRootNode = sourceReference.RootNode.GetPathFilterDescendants(NodeFilters.BreakAtNestedQueryBlock, NonTerminals.InnerTableReference, NonTerminals.InnerSpecialTableReference).Last();
			sourceReference.RootNode = innerTableReferenceRootNode;

			Container = Owner = sourceReference.Owner;
			Owner.ObjectReferences.Remove(sourceReference);
			Owner.ObjectReferences.Add(this);

			SourceReferenceContainer = new OracleReferenceContainer(semanticModel);
			SourceReferenceContainer.ObjectReferences.Add(sourceReference);

			var aggregateExpressions = new List<StatementGrammarNode>();

			var pivotExpressions = PivotClause[NonTerminals.PivotAliasedAggregationFunctionList];
			if (pivotExpressions != null)
			{
				foreach (var pivotAggregationFunction in pivotExpressions.GetDescendants(NonTerminals.PivotAliasedAggregationFunction))
				{
					var aliasNode = pivotAggregationFunction[NonTerminals.ColumnAsAlias, Terminals.ColumnAlias];
					_columnNameExtensions.Add(aliasNode == null ? String.Empty : $"_{aliasNode.Token.Value.ToQuotedIdentifier().Trim('"')}");
					aggregateExpressions.Add(pivotAggregationFunction);
				}
			}

			AggregateFunctions = aggregateExpressions.AsReadOnly();
		}
Beispiel #4
0
		private static OracleDataObjectReference GetObjectReference(OracleReferenceContainer column)
		{
			var columnReference = column.ColumnReferences.FirstOrDefault();
			return columnReference != null && columnReference.ColumnNodeObjectReferences.Count == 1
				? columnReference.ColumnNodeObjectReferences.First() as OracleDataObjectReference
				: null;
		}
Beispiel #5
0
		private static ICollection<OracleReferenceContainer> GetReferenceContainers(OracleReferenceContainer mainContainer, OracleQueryBlock currentQueryBlock)
		{
			var referenceContainers = new List<OracleReferenceContainer> { mainContainer };
			if (currentQueryBlock != null)
			{
				referenceContainers.Add(currentQueryBlock);
				referenceContainers.AddRange(currentQueryBlock.Columns);

				if (currentQueryBlock.OuterCorrelatedQueryBlock != null)
				{
					referenceContainers.Add(currentQueryBlock.OuterCorrelatedQueryBlock);
				}
			}

			return referenceContainers;
		}
Beispiel #6
0
		public OracleColumnReference(OracleReferenceContainer referenceContainer)
		{
			ColumnNodeObjectReferences = new HashSet<OracleObjectWithColumnsReference>();
			ColumnNodeColumnReferences = new List<OracleColumn>();
			Container = referenceContainer;
		}
Beispiel #7
0
 public OracleColumnReference(OracleReferenceContainer referenceContainer)
 {
     ColumnNodeObjectReferences = new HashSet <OracleObjectWithColumnsReference>();
     ColumnNodeColumnReferences = new List <OracleColumn>();
     Container = referenceContainer;
 }
Beispiel #8
0
		private static string GetDefaultExpression(OracleReferenceContainer program, OraclePlSqlVariable variable)
		{
			return variable.DefaultExpressionNode == null || !variable.IsConstant
				? String.Empty
				: variable.DefaultExpressionNode.GetText(program.SemanticModel.StatementText);
		}
Beispiel #9
0
		public OracleTableCollectionReference(OracleReferenceContainer referenceContainer) : base(ReferenceType.TableCollection)
		{
			referenceContainer.ObjectReferences.Add(this);
			Container = referenceContainer;
			Placement = StatementPlacement.TableReference;
		}
 public OracleTableCollectionReference(OracleReferenceContainer referenceContainer) : base(ReferenceType.TableCollection)
 {
     referenceContainer.ObjectReferences.Add(this);
     Container = referenceContainer;
     Placement = StatementPlacement.TableReference;
 }