DeveelDB  20151217
complete SQL database system, primarly developed for .NET/Mono frameworks
Classes | Public Member Functions | Protected Member Functions | Properties | Private Member Functions | List of all members
Deveel.Data.Sql.Query.RangeSelectNode Class Reference

The node for performing a simple indexed query on a single column of the child node. More...

Inheritance diagram for Deveel.Data.Sql.Query.RangeSelectNode:
Deveel.Data.Sql.Query.SingleQueryPlanNode Deveel.Data.Sql.Query.IQueryPlanNode Deveel.Data.Serialization.ISerializable

Classes

class  RangeSetCalculator
 
class  RangeSetUpdater
 

Public Member Functions

 RangeSelectNode (IQueryPlanNode child, SqlExpression expression)
 
override ITable Evaluate (IRequest context)
 

Protected Member Functions

override void GetData (SerializeData data)
 
- Protected Member Functions inherited from Deveel.Data.Sql.Query.SingleQueryPlanNode
 SingleQueryPlanNode (IQueryPlanNode child)
 
 SingleQueryPlanNode (ObjectData data)
 

Properties

SqlExpression Expression [get, private set]
 A simple expression that represents the range to select. See the class comments for a description for how this expression must be formed. More...
 
- Properties inherited from Deveel.Data.Sql.Query.SingleQueryPlanNode
IQueryPlanNode Child [get, private set]
 Gets the single child node of the plan. More...
 

Private Member Functions

 RangeSelectNode (ObjectData data)
 

Detailed Description

The node for performing a simple indexed query on a single column of the child node.

Finds the set from the child node that matches the range.

The given Expression object must conform to a number of rules. It may reference only one column in the child node. It must consist of only simple mathemetical and logical operators (<, >, =, <>, >=, <=, AND, OR). The left side of each mathematical operator must be a variable, and the right side must be a constant (parameter subsitution or correlated value).

Breaking any of these rules will mean the range select can not happen.

For example:

(col > 10 AND col < 100) OR col > 1000 OR col == 10

Definition at line 53 of file RangeSelectNode.cs.

Constructor & Destructor Documentation

Deveel.Data.Sql.Query.RangeSelectNode.RangeSelectNode ( IQueryPlanNode  child,
SqlExpression  expression 
)
inline

Definition at line 54 of file RangeSelectNode.cs.

55  : base(child) {
56  Expression = expression;
57  }
SqlExpression Expression
A simple expression that represents the range to select. See the class comments for a description for...
Deveel.Data.Sql.Query.RangeSelectNode.RangeSelectNode ( ObjectData  data)
inlineprivate

Definition at line 59 of file RangeSelectNode.cs.

60  : base(data) {
61  Expression = data.GetValue<SqlExpression>("Expression");
62  }
SqlExpression Expression
A simple expression that represents the range to select. See the class comments for a description for...
Defines the base class for instances that represent SQL expression tree nodes.

Member Function Documentation

override ITable Deveel.Data.Sql.Query.RangeSelectNode.Evaluate ( IRequest  context)
inlinevirtual

Implements Deveel.Data.Sql.Query.SingleQueryPlanNode.

Definition at line 76 of file RangeSelectNode.cs.

76  {
77  var t = Child.Evaluate(context);
78 
79  var exp = Expression;
80 
81  // Assert that all variables in the expression are identical.
82  var columnNames = exp.DiscoverReferences();
83  ObjectName columnName = null;
84  foreach (var cv in columnNames) {
85  if (columnName != null && !cv.Equals(columnName))
86  throw new InvalidOperationException("Range plan does not contain common column.");
87 
88  columnName = cv;
89  }
90 
91  // Find the variable field in the table.
92  var col = t.IndexOfColumn(columnName);
93  if (col == -1)
94  throw new InvalidOperationException("Could not find column reference in table: " + columnName);
95 
96  var field = t.TableInfo[col];
97 
98  // Calculate the range
99  var range = new IndexRangeSet();
100  var calculator = new RangeSetCalculator(context, field, range);
101  range = calculator.Calculate(exp);
102 
103  // Select the range from the table
104  var ranges = range.ToArray();
105  return t.SelectRange(columnName, ranges);
106  }
ITable Evaluate(IRequest context)
IQueryPlanNode Child
Gets the single child node of the plan.
SqlExpression Expression
A simple expression that represents the range to select. See the class comments for a description for...
override void Deveel.Data.Sql.Query.RangeSelectNode.GetData ( SerializeData  data)
inlineprotectedvirtual

Reimplemented from Deveel.Data.Sql.Query.SingleQueryPlanNode.

Definition at line 71 of file RangeSelectNode.cs.

71  {
72  data.SetValue("Expression", Expression);
73  }
SqlExpression Expression
A simple expression that represents the range to select. See the class comments for a description for...
void SetValue(string key, Type type, object value)

Property Documentation

SqlExpression Deveel.Data.Sql.Query.RangeSelectNode.Expression
getprivate set

A simple expression that represents the range to select. See the class comments for a description for how this expression must be formed.

Definition at line 69 of file RangeSelectNode.cs.


The documentation for this class was generated from the following file: