示例#1
0
        private void CreateColumnRefs()
        {
            List <ColumnRefBinding> tableColumnRefs = new List <ColumnRefBinding>();

            if (!(_definition is DerivedTableBinding) && !(_definition is CommonTableBinding))
            {
                // Create special row column ref

                ColumnRefBinding rowColumnRefBinding = CreateRowColumnRefBinding(this);
                tableColumnRefs.Add(rowColumnRefBinding);
            }

            // Create all column refs.

            foreach (ColumnBinding columnDefinition in _definition.Columns)
            {
                ColumnRefBinding columnRefBinding = new ColumnRefBinding(this, columnDefinition);

                RowBufferEntry rowBufferEntry = new RowBufferEntry(columnRefBinding.ColumnBinding.DataType);
                rowBufferEntry.Name = columnRefBinding.GetFullName();

                ColumnValueDefinition columnValueDefinition = new ColumnValueDefinition();
                columnValueDefinition.Target           = rowBufferEntry;
                columnValueDefinition.ColumnRefBinding = columnRefBinding;

                columnRefBinding.ValueDefinition = columnValueDefinition;
                tableColumnRefs.Add(columnRefBinding);
            }

            // Assign column refs to table ref.

            _columnRefs = tableColumnRefs.ToArray();
        }
示例#2
0
		public override void Enumerate(IMemberCompletionAcceptor acceptor)
		{
			if (acceptor == null)
				throw ExceptionBuilder.ArgumentNull("acceptor");
			
			// Report all columns accessible by the table ref.
							
			TableRefBinding tableRefBinding = new TableRefBinding(null, _tableBinding, _correlationName);
			foreach (ColumnBinding columnBinding in _tableBinding.Columns)
			{
				ColumnRefBinding columnRefBinding = new ColumnRefBinding(tableRefBinding, columnBinding);
				acceptor.AcceptColumnRef(columnRefBinding);
			}
							
			// Now contribute any methods accessible by the row type.

			IMethodProvider methodProvider = _scope.DataContext.MetadataContext.MethodProviders[_tableBinding.RowType];
				
			if (methodProvider != null)
			{
				MethodBinding[] methods = methodProvider.GetMethods(_tableBinding.RowType);
				foreach (MethodBinding methodBinding in  methods)
					acceptor.AcceptMethod(methodBinding);
			}
		}
示例#3
0
		private void CreateColumnRefs()
		{
			List<ColumnRefBinding> tableColumnRefs = new List<ColumnRefBinding>();

			if (!(_definition is DerivedTableBinding) && !(_definition is CommonTableBinding))
			{
				// Create special row column ref

				ColumnRefBinding rowColumnRefBinding = CreateRowColumnRefBinding(this);
				tableColumnRefs.Add(rowColumnRefBinding);
			}

			// Create all column refs.

			foreach (ColumnBinding columnDefinition in _definition.Columns)
			{
				ColumnRefBinding columnRefBinding = new ColumnRefBinding(this, columnDefinition);

				RowBufferEntry rowBufferEntry = new RowBufferEntry(columnRefBinding.ColumnBinding.DataType);
				rowBufferEntry.Name = columnRefBinding.GetFullName();

				ColumnValueDefinition columnValueDefinition = new ColumnValueDefinition();
				columnValueDefinition.Target = rowBufferEntry;
				columnValueDefinition.ColumnRefBinding = columnRefBinding;

				columnRefBinding.ValueDefinition = columnValueDefinition;
				tableColumnRefs.Add(columnRefBinding);
			}

			// Assign column refs to table ref.

			_columnRefs = tableColumnRefs.ToArray();
		}
示例#4
0
		public override IEnumerable GetRows(ColumnRefBinding[] neededColumns)
		{
			foreach (DataRow dataRow in _dataTable.Rows)
			{
				if (dataRow.RowState != DataRowState.Deleted)
					yield return dataRow;
			}
		}
示例#5
0
		public MetaInfo(ColumnRefBinding[] columnDependencies, 
		                TableRefBinding[] tableDependencies,
		                bool containsSingleRowSubselects, 
		                bool containsExistenceSubselects)
		{
			_columnDependencies = columnDependencies;
			_tableDependencies = tableDependencies;
			_containsSingleRowSubselects = containsSingleRowSubselects;
			_containsExistenceSubselects = containsExistenceSubselects;
		}
示例#6
0
		private static ColumnRefBinding CreateRowColumnRefBinding(TableRefBinding tableRefBinding)
		{
			RowColumnBinding rowColumnBinding = new RowColumnBinding(tableRefBinding.TableBinding);
			ColumnRefBinding rowColumnRefBinding = new ColumnRefBinding(tableRefBinding, rowColumnBinding);

			RowBufferEntry rowColumnBufferEntry = new RowBufferEntry(rowColumnRefBinding.ColumnBinding.DataType);
			rowColumnBufferEntry.Name = rowColumnRefBinding.TableRefBinding.Name;

			ColumnValueDefinition rowColumnValueDefinition = new ColumnValueDefinition();
			rowColumnValueDefinition.Target = rowColumnBufferEntry;
			rowColumnValueDefinition.ColumnRefBinding = rowColumnRefBinding;

			rowColumnRefBinding.ValueDefinition = rowColumnValueDefinition;
			return rowColumnRefBinding;
		}
示例#7
0
        public static string FormatColumnRefList(ColumnRefBinding[] columnRefBindings)
        {
            StringBuilder sb = new StringBuilder();

            foreach (ColumnRefBinding columnRefBinding in columnRefBindings)
            {
                if (sb.Length > 0)
                    sb.Append(", ");

                sb.Append("'");
                sb.Append(columnRefBinding.GetFullName());
                sb.Append("'");
            }

            return sb.ToString();
        }
示例#8
0
        private static ColumnRefBinding CreateRowColumnRefBinding(TableRefBinding tableRefBinding)
        {
            RowColumnBinding rowColumnBinding    = new RowColumnBinding(tableRefBinding.TableBinding);
            ColumnRefBinding rowColumnRefBinding = new ColumnRefBinding(tableRefBinding, rowColumnBinding);

            RowBufferEntry rowColumnBufferEntry = new RowBufferEntry(rowColumnRefBinding.ColumnBinding.DataType);

            rowColumnBufferEntry.Name = rowColumnRefBinding.TableRefBinding.Name;

            ColumnValueDefinition rowColumnValueDefinition = new ColumnValueDefinition();

            rowColumnValueDefinition.Target           = rowColumnBufferEntry;
            rowColumnValueDefinition.ColumnRefBinding = rowColumnRefBinding;

            rowColumnRefBinding.ValueDefinition = rowColumnValueDefinition;
            return(rowColumnRefBinding);
        }
示例#9
0
		private void AddColumn(ColumnRefBinding column)
		{
			if (IsOuterScope(column.Scope) && !_columnBindingList.Contains(column))
				_columnBindingList.Add(column);
		}
示例#10
0
		public void AcceptColumnRef(ColumnRefBinding columnRef)
		{
			Add(columnRef.Name, columnRef.GetFullName(), columnRef.ColumnBinding.DataType.Name, PROPERTY_IMG_INDEX);
		}
示例#11
0
		public abstract IEnumerable GetRows(ColumnRefBinding[] neededColumns);
示例#12
0
 void IErrorReporter.AmbiguousColumnRef(SourceRange sourceRange, Identifier identifier, ColumnRefBinding[] candidates)
 {
     string message = String.Format(CultureInfo.CurrentCulture, Resources.AmbiguousColumnRef, identifier, FormattingHelpers.FormatBindingList(candidates));
     HandleError(sourceRange, ErrorId.AmbiguousColumnRef, message);
 }
示例#13
0
 void IErrorReporter.SelectExpressionNotAggregatedOrGrouped(ColumnRefBinding columnRefBinding)
 {
     string message = String.Format(CultureInfo.CurrentCulture, Resources.SelectExpressionNotAggregatedOrGrouped, columnRefBinding.GetFullName());
     HandleError(ErrorId.SelectExpressionNotAggregatedOrGrouped, message);
 }
示例#14
0
 void IErrorReporter.OrderByExpressionNotAggregatedAndNoGroupBy(ColumnRefBinding columnRefBinding)
 {
     string message = String.Format(CultureInfo.CurrentCulture, Resources.OrderByExpressionNotAggregatedAndNoGroupBy, columnRefBinding.GetFullName());
     HandleError(ErrorId.OrderByExpressionNotAggregatedAndNoGroupBy, message);
 }
示例#15
0
		public override IEnumerable GetRows(ColumnRefBinding[] neededColumns)
		{
			return _enumerable;
		}
示例#16
0
		public override IEnumerable GetRows(ColumnRefBinding[] neededColumns)
		{
			// This method is called to produce an enumerable that represents
			// the rows.
			//
			// NQuery will pass the values of this enumerator to method
			// MyColumnBinding.GetValue() to get the value of the column 
			// in a row.
			return _tableData.Rows;
		}
示例#17
0
		public ColumnExpression(ColumnRefBinding columnRefBinding)
		{
			_columnRefBinding = columnRefBinding;
		}
示例#18
0
		public void AcceptColumnRef(ColumnRefBinding column)
		{
		}
示例#19
0
		public override IEnumerable GetRows(ColumnRefBinding[] neededColumns)
		{
			throw new NotImplementedException();
		}
示例#20
0
		private void WriteColumnRef(ColumnRefBinding columnRefBinding)
		{
			_xmlWriter.WriteAttributeString("column", columnRefBinding.Name);
			WriteTableRef(columnRefBinding.TableRefBinding);
		}