Bind() static private méthode

static private Bind ( DataRelation relation, List list ) : void
relation DataRelation
list List
Résultat void
Exemple #1
0
        internal override void Bind(DataTable table, List <DataColumn> list)
        {
            base.BindTable(table);
            this.column   = null;
            this.relation = null;
            if (table == null)
            {
                throw ExprException.ExpressionUnbound(this.ToString());
            }
            DataRelationCollection parentRelations = table.ParentRelations;

            if (this.relationName == null)
            {
                if (parentRelations.Count > 1)
                {
                    throw ExprException.UnresolvedRelation(table.TableName, this.ToString());
                }
                this.relation = parentRelations[0];
            }
            else
            {
                this.relation = parentRelations[this.relationName];
            }
            if (this.relation == null)
            {
                throw ExprException.BindFailure(this.relationName);
            }
            DataTable parentTable = this.relation.ParentTable;

            this.column = parentTable.Columns[this.columnName];
            if (this.column == null)
            {
                throw ExprException.UnboundName(this.columnName);
            }
            int num = 0;

            while (num < list.Count)
            {
                DataColumn column = list[num];
                if (this.column == column)
                {
                    break;
                }
                num++;
            }
            if (num >= list.Count)
            {
                list.Add(this.column);
            }
            AggregateNode.Bind(this.relation, list);
        }
Exemple #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(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);
        }
Exemple #3
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);
        }
        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);
        }
Exemple #5
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);
        }