DeveelDB  20151217
complete SQL database system, primarly developed for .NET/Mono frameworks
Public Member Functions | Protected Member Functions | Properties | Private Member Functions | List of all members
Deveel.Data.Sql.Query.SortNode Class Reference
Inheritance diagram for Deveel.Data.Sql.Query.SortNode:
Deveel.Data.Sql.Query.SingleQueryPlanNode Deveel.Data.Sql.Query.IQueryPlanNode Deveel.Data.Serialization.ISerializable

Public Member Functions

 SortNode (IQueryPlanNode child, ObjectName[] columnNames, bool[] ascending)
 
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

ObjectName[] ColumnNames [get, private set]
 
bool[] Ascending [get, private set]
 
- 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

 SortNode (ObjectData data)
 

Detailed Description

Definition at line 25 of file SortNode.cs.

Constructor & Destructor Documentation

Deveel.Data.Sql.Query.SortNode.SortNode ( IQueryPlanNode  child,
ObjectName[]  columnNames,
bool[]  ascending 
)
inline

Definition at line 26 of file SortNode.cs.

27  : base(child) {
28 
29  // How we handle ascending/descending order
30  // ----------------------------------------
31  // Internally to the database, all columns are naturally ordered in
32  // ascending order (start at lowest and end on highest). When a column
33  // is ordered in descending order, a fast way to achieve this is to take
34  // the ascending set and reverse it. This works for single columns,
35  // however some thought is required for handling multiple column. We
36  // order columns from RHS to LHS. If LHS is descending then this will
37  // order the RHS incorrectly if we leave as is. Therefore, we must do
38  // some pre-processing that looks ahead on any descending orders and
39  // reverses the order of the columns to the right. This pre-processing
40  // is done in the first pass.
41 
42  int sz = ascending.Length;
43  for (int n = 0; n < sz - 1; ++n) {
44  if (!ascending[n]) { // if descending...
45  // Reverse order of all columns to the right...
46  for (int p = n + 1; p < sz; ++p) {
47  ascending[p] = !ascending[p];
48  }
49  }
50  }
51 
52  ColumnNames = columnNames;
53  Ascending = ascending;
54  }
Deveel.Data.Sql.Query.SortNode.SortNode ( ObjectData  data)
inlineprivate

Definition at line 56 of file SortNode.cs.

57  : base(data) {
58  ColumnNames = data.GetValue<ObjectName[]>("Columns");
59  Ascending = data.GetValue<bool[]>("Ascending");
60  }

Member Function Documentation

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

Implements Deveel.Data.Sql.Query.SingleQueryPlanNode.

Definition at line 66 of file SortNode.cs.

66  {
67  var t = Child.Evaluate(context);
68  return t.OrderBy(ColumnNames, Ascending);
69  }
ITable Evaluate(IRequest context)
IQueryPlanNode Child
Gets the single child node of the plan.
override void Deveel.Data.Sql.Query.SortNode.GetData ( SerializeData  data)
inlineprotectedvirtual

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

Definition at line 71 of file SortNode.cs.

71  {
72  data.SetValue("Columns", ColumnNames);
73  data.SetValue("Ascending", Ascending);
74  }
void SetValue(string key, Type type, object value)

Property Documentation

bool [] Deveel.Data.Sql.Query.SortNode.Ascending
getprivate set

Definition at line 64 of file SortNode.cs.

ObjectName [] Deveel.Data.Sql.Query.SortNode.ColumnNames
getprivate set

Definition at line 62 of file SortNode.cs.


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