56 Expression = expression;
72 data.
SetValue(
"Expression", Expression);
77 var t = Child.Evaluate(context);
82 var columnNames = exp.DiscoverReferences();
84 foreach (var cv
in columnNames) {
85 if (columnName != null && !cv.Equals(columnName))
86 throw new InvalidOperationException(
"Range plan does not contain common column.");
92 var col = t.IndexOfColumn(columnName);
94 throw new InvalidOperationException(
"Could not find column reference in table: " + columnName);
96 var field = t.TableInfo[col];
101 range = calculator.Calculate(exp);
104 var ranges = range.ToArray();
105 return t.SelectRange(columnName, ranges);
108 #region RangeSetUpdater
116 this.context = context;
118 this.indexRangeSet = indexRangeSet;
123 return indexRangeSet;
130 var value = binaryEpression.
Right.EvaluateToConstant(context, null);
134 var fieldType = field.ColumnType;
135 if (!value.Type.IsComparable(fieldType))
139 indexRangeSet = indexRangeSet.
Intersect(op, value);
141 return base.VisitBinary(binaryEpression);
147 #region RangeSetCalculator
155 this.context = context;
157 this.rangeSet = rangeSet;
162 return updater.Update(expression);
168 return calculator.Calculate(expression);
173 rangeSet = UpdateRange(binaryEpression.
Left);
174 rangeSet = UpdateRange(binaryEpression.
Right);
176 var left = CalcExpression(binaryEpression.
Left);
177 var right = CalcExpression(binaryEpression.
Right);
179 rangeSet = rangeSet.
Union(left);
180 rangeSet = rangeSet.
Union(right);
182 rangeSet = UpdateRange(binaryEpression);
185 return base.VisitBinary(binaryEpression);
Defines the metadata properties of a column within a table of a database.
override void GetData(SerializeData data)
override SqlExpressionType ExpressionType
Defines the contract to access the data contained into a table of a database.
RangeSelectNode(ObjectData data)
override SqlExpression VisitBinary(SqlBinaryExpression binaryEpression)
readonly ColumnInfo field
A IQueryPlanNode with a single child.
static DataObject Null(SqlType type)
void SetValue(string key, Type type, object value)
Describes the name of an object within a database.
SqlExpressionType
All the possible type of SqlExpression supported
The node for performing a simple indexed query on a single column of the child node.
override SqlExpression VisitBinary(SqlBinaryExpression binaryEpression)
A node element of a query plan tree. /summary>
RangeSelectNode(IQueryPlanNode child, SqlExpression expression)
IndexRangeSet CalcExpression(SqlExpression expression)
IndexRangeSet Update(SqlExpression expression)
Represents a dynamic object that encapsulates a defined SqlType and a compatible constant ISqlObject ...
IndexRangeSet indexRangeSet
readonly ColumnInfo field
readonly IRequest context
IndexRangeSet Intersect(SqlExpressionType op, DataObject value)
object GetValue(string key)
override ITable Evaluate(IRequest context)
Defines the base class for instances that represent SQL expression tree nodes.
readonly IRequest context
IndexRangeSet Calculate(SqlExpression expression)
IndexRangeSet UpdateRange(SqlExpression expression)
RangeSetCalculator(IRequest context, ColumnInfo field, IndexRangeSet rangeSet)
A visitor for SqlExpression objects.
IndexRangeSet Union(IndexRangeSet unionTo)
Unions the current range set with the given range set.
RangeSetUpdater(IRequest context, ColumnInfo field, IndexRangeSet indexRangeSet)