internal override object Eval(DataRow row, DataRowVersion version) { if (!found) { #if DEBUG if (CompModSwitches.NameNode.TraceVerbose) { Debug.WriteLine("Can not find column " + name); } #endif throw ExprException.UnboundName(name); } if (row == null) { if (IsTableConstant()) // this column is TableConstant Aggregate Function { return(column.DataExpression.Evaluate()); } else { #if DEBUG if (CompModSwitches.NameNode.TraceVerbose) { Debug.WriteLine("Can not eval column without a row.." + name); } #endif throw ExprException.UnboundName(name); } } return(column[row.GetRecordFromVersion(version)]); }
internal override void Bind(DataTable table, List <DataColumn> list) { base.BindTable(table); if (table == null) { throw ExprException.AggregateUnbound(this.ToString()); } if (this.local) { this.relation = null; } else { DataRelationCollection childRelations = table.ChildRelations; if (this.relationName == null) { if (childRelations.Count > 1) { throw ExprException.UnresolvedRelation(table.TableName, this.ToString()); } if (childRelations.Count != 1) { throw ExprException.AggregateUnbound(this.ToString()); } this.relation = childRelations[0]; } else { this.relation = childRelations[this.relationName]; } } this.childTable = (this.relation == null) ? table : this.relation.ChildTable; this.column = this.childTable.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); } Bind(this.relation, list); }
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); }
internal override void Bind(DataTable table, List <DataColumn> list) { BindTable(table); if (table == null) { throw ExprException.UnboundName(_name); } try { _column = table.Columns[_name]; } catch (Exception e) { _found = false; if (!Common.ADP.IsCatchableExceptionType(e)) { throw; } throw ExprException.UnboundName(_name); } if (_column == null) { throw ExprException.UnboundName(_name); } _name = _column.ColumnName; _found = true; // add column to the dependency list, do not add duplicate columns Debug.Assert(_column != null, "Failed to bind column " + _name); 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); } }
internal override object Eval(DataRow row, DataRowVersion version) { if (!this.found) { throw ExprException.UnboundName(this.name); } if (row != null) { return(this.column[row.GetRecordFromVersion(version)]); } if (!this.IsTableConstant()) { throw ExprException.UnboundName(this.name); } return(this.column.DataExpression.Evaluate()); }
internal override void Bind(DataTable table, List <DataColumn> list) { base.BindTable(table); if (table == null) { throw ExprException.UnboundName(this.name); } try { this.column = table.Columns[this.name]; } catch (Exception exception) { this.found = false; if (!ADP.IsCatchableExceptionType(exception)) { throw; } throw ExprException.UnboundName(this.name); } if (this.column == null) { throw ExprException.UnboundName(this.name); } this.name = this.column.ColumnName; this.found = true; 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); } }
internal override object Eval(DataRow?row, DataRowVersion version) { if (!_found) { throw ExprException.UnboundName(_name); } if (row == null) { if (IsTableConstant()) // this column is TableConstant Aggregate Function { return(_column !.DataExpression !.Evaluate()); } else { throw ExprException.UnboundName(_name); } } return(_column ![row.GetRecordFromVersion(version)]);
internal override void Bind(DataTable table, ArrayList list) { #if DEBUG if (CompModSwitches.LookupNode.TraceVerbose) { Debug.WriteLine("Binding lookup column " + this.ToString()); } #endif 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]; } Debug.Assert(relation != null, "The relation should be resolved (bound) at this point."); this.table = relation.ParentTable; Debug.Assert(relation != null, "Invalid relation: no parent table."); Debug.Assert(columnName != null, "All Lookup expressions have columnName set."); this.column = this.table.Columns[columnName]; if (column == null) { throw ExprException.UnboundName(columnName); } // add column to the dependency list 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) { #if DEBUG if (CompModSwitches.LookupNode.TraceVerbose) { Debug.WriteLine("the column found in the dependency list"); } #endif break; } } if (i >= list.Count) { #if DEBUG if (CompModSwitches.LookupNode.TraceVerbose) { Debug.WriteLine("Adding column to our dependency list: " + column.ColumnName); } #endif list.Add(column); } }
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); }
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, ArrayList list) { if (table == null) { throw ExprException.UnboundName(name); } try { this.column = table.Columns[name]; this.table = table; } catch (Exception) { #if DEBUG if (CompModSwitches.NameNode.TraceVerbose) { Debug.WriteLine("Can not find column " + name); } #endif found = false; throw ExprException.UnboundName(name); } if (column == null) { throw ExprException.UnboundName(name); } #if DEBUG if (CompModSwitches.NameNode.TraceVerbose) { Debug.WriteLine("Binding name node " + name); } #endif name = column.ColumnName; found = true; // add column to the dependency list, do not add duplicate columns Debug.Assert(column != null, "Failed to bind column " + name); 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) { #if DEBUG if (CompModSwitches.NameNode.TraceVerbose) { Debug.WriteLine("the column found in the dependency list"); } #endif break; } } if (i >= list.Count) { #if DEBUG if (CompModSwitches.NameNode.TraceVerbose) { Debug.WriteLine("Adding column to our dependency list: " + column.ColumnName); } #endif list.Add(column); } }
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); }
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); }
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"); }