UnresolvedRelation() public static method

public static UnresolvedRelation ( string name, string expr ) : Exception
name string
expr string
return Exception
Beispiel #1
0
        internal override void Bind(DataTable table, List <DataColumn> list)
        {
            BindTable(table);
            if (table == null)
            {
                throw ExprException.AggregateUnbound(this.ToString());
            }

            if (local)
            {
                relation = null;
            }
            else
            {
                DataRelationCollection relations;
                relations = table.ChildRelations;

                if (relationName == null)
                {
                    // must have one and only one relation

                    if (relations.Count > 1)
                    {
                        throw ExprException.UnresolvedRelation(table.TableName, this.ToString());
                    }
                    if (relations.Count == 1)
                    {
                        relation = relations[0];
                    }
                    else
                    {
                        throw ExprException.AggregateUnbound(this.ToString());
                    }
                }
                else
                {
                    relation = relations[relationName];
                }
            }

            childTable = (relation == null) ? table : relation.ChildTable;

            this.column = childTable.Columns[columnName];

            if (column == null)
            {
                throw ExprException.UnboundName(columnName);
            }

            // add column to the dependency list, do not add duplicate columns

            Debug.Assert(column != null, "Failed to bind column " + columnName);

            int i;

            for (i = 0; i < list.Count; i++)
            {
                // walk the list, check if the current column already on the list
                DataColumn dataColumn = (DataColumn)list[i];
                if (column == dataColumn)
                {
                    break;
                }
            }
            if (i >= list.Count)
            {
                list.Add(column);
            }

            // SQLBU 383715: Staleness of computed values in expression column as the relationship end columns are not being added to the dependent column list.
            AggregateNode.Bind(relation, list);
        }
Beispiel #2
0
        internal override void Bind(DataTable table, List <DataColumn> list)
        {
            BindTable(table);
            column   = null; // clear for rebinding (if original binding was valid)
            relation = null;

            if (table == null)
            {
                throw ExprException.ExpressionUnbound(this.ToString());
            }

            // First find parent table

            DataRelationCollection relations;

            relations = table.ParentRelations;

            if (relationName == null)
            {
                // must have one and only one relation

                if (relations.Count > 1)
                {
                    throw ExprException.UnresolvedRelation(table.TableName, this.ToString());
                }
                relation = relations[0];
            }
            else
            {
                relation = relations[relationName];
            }
            if (null == relation)
            {
                throw ExprException.BindFailure(relationName);// WebData 112162: this operation is not clne specific, throw generic exception
            }
            DataTable parentTable = relation.ParentTable;

            Debug.Assert(relation != null, "Invalid relation: no parent table.");
            Debug.Assert(columnName != null, "All Lookup expressions have columnName set.");

            this.column = parentTable.Columns[columnName];

            if (column == null)
            {
                throw ExprException.UnboundName(columnName);
            }

            // add column to the dependency list

            int i;

            for (i = 0; i < list.Count; i++)
            {
                // walk the list, check if the current column already on the list
                DataColumn dataColumn = list[i];
                if (column == dataColumn)
                {
                    break;
                }
            }
            if (i >= list.Count)
            {
                list.Add(column);
            }

            // SQLBU 383715: Staleness of computed values in expression column as the relationship end columns are not being added to the dependent column list.
            AggregateNode.Bind(relation, list);
        }
Beispiel #3
0
        internal override void Bind(DataTable table, List <DataColumn> list)
        {
            BindTable(table);
            _column   = null; // clear for rebinding (if original binding was valid)
            _relation = null;

            if (table == null)
            {
                throw ExprException.ExpressionUnbound(ToString() !);
            }

            // First find parent table

            DataRelationCollection relations;

            relations = table.ParentRelations;

            if (_relationName == null)
            {
                // must have one and only one relation

                if (relations.Count > 1)
                {
                    throw ExprException.UnresolvedRelation(table.TableName, ToString() !);
                }
                _relation = relations[0];
            }
            else
            {
                _relation = relations[_relationName];
            }
            if (null == _relation)
            {
                throw ExprException.BindFailure(_relationName !); // this operation is not clone specific, throw generic exception
            }
            DataTable parentTable = _relation.ParentTable;

            Debug.Assert(_relation != null, "Invalid relation: no parent table.");
            Debug.Assert(_columnName != null, "All Lookup expressions have columnName set.");

            _column = parentTable.Columns[_columnName];

            if (_column == null)
            {
                throw ExprException.UnboundName(_columnName);
            }

            // add column to the dependency list

            int i;

            for (i = 0; i < list.Count; i++)
            {
                // walk the list, check if the current column already on the list
                DataColumn dataColumn = list[i];
                if (_column == dataColumn)
                {
                    break;
                }
            }
            if (i >= list.Count)
            {
                list.Add(_column);
            }

            AggregateNode.Bind(_relation, list);
        }
Beispiel #4
0
        internal override void Bind(DataTable table, List <DataColumn> list)
        {
            BindTable(table);
            if (table == null)
            {
                throw ExprException.AggregateUnbound(ToString() !);
            }

            if (_local)
            {
                _relation = null;
            }
            else
            {
                DataRelationCollection relations;
                relations = table.ChildRelations;

                if (_relationName == null)
                {
                    // must have one and only one relation

                    if (relations.Count > 1)
                    {
                        throw ExprException.UnresolvedRelation(table.TableName, ToString() !);
                    }
                    if (relations.Count == 1)
                    {
                        _relation = relations[0];
                    }
                    else
                    {
                        throw ExprException.AggregateUnbound(ToString() !);
                    }
                }
                else
                {
                    _relation = relations[_relationName];
                }
            }

            _childTable = (_relation == null) ? table : _relation.ChildTable;

            _column = _childTable.Columns[_columnName];

            if (_column == null)
            {
                throw ExprException.UnboundName(_columnName);
            }

            // add column to the dependency list, do not add duplicate columns

            Debug.Assert(_column != null, "Failed to bind column " + _columnName);

            int i;

            for (i = 0; i < list.Count; i++)
            {
                // walk the list, check if the current column already on the list
                DataColumn dataColumn = list[i];
                if (_column == dataColumn)
                {
                    break;
                }
            }
            if (i >= list.Count)
            {
                list.Add(_column);
            }

            AggregateNode.Bind(_relation, list);
        }
Beispiel #5
0
        internal override void Bind(DataTable table, ArrayList list)
        {
#if DEBUG
            if (CompModSwitches.AggregateNode.TraceVerbose)
            {
                Debug.WriteLine("Binding Aggregate expression " + this.ToString());
            }
#endif
            if (table == null)
            {
                throw ExprException.AggregateUnbound(this.ToString());
            }

#if DEBUG
            if (CompModSwitches.AggregateNode.TraceVerbose)
            {
                Debug.WriteLine("in table " + table.TableName);
            }
#endif
            if (local)
            {
                relation = null;
            }
            else
            {
                DataRelationCollection relations;
                relations = table.ChildRelations;

                if (relationName == null)
                {
                    // must have one and only one relation

                    if (relations.Count > 1)
                    {
                        throw ExprException.UnresolvedRelation(table.TableName, this.ToString());
                    }
                    if (relations.Count == 1)
                    {
                        relation = relations[0];
                    }
                    else
                    {
                        throw ExprException.AggregateUnbound(this.ToString());
                    }
                }
                else
                {
                    relation = relations[relationName];
                }
                Debug.Assert(relation != null, String.Format(Res.GetString(Res.Expr_AggregateUnbound), this.ToString()));
            }

            DataTable childTable = (relation == null) ? table : relation.ChildTable;
            this.table = childTable;

            this.column = childTable.Columns[columnName];

            if (column == null)
            {
                throw ExprException.UnboundName(columnName);
            }

            // add column to the dependency list, do not add duplicate columns

            Debug.Assert(column != null, "Failed to bind column " + columnName);

            int i;
            for (i = 0; i < list.Count; i++)
            {
                // walk the list, check if the current column already on the list
                DataColumn dataColumn = (DataColumn)list[i];
                if (column == dataColumn)
                {
                    break;
                }
            }
            if (i >= list.Count)
            {
                list.Add(column);
            }

            //UNDONE : Debug.WriteLineIf("AggregateNode", this.ToString() + " bound");
        }