2using System.Threading.Tasks;
17 private readonly
bool[] ascending;
18 private readonly
int nrColumns;
34 this.nrColumns = Columns.
Length;
35 if (Ascending.Length !=
this.nrColumns)
36 throw new ArgumentException(
"Number of columns does not match number of ascending argument values.", nameof(Ascending));
44 this.columns = Columns;
47 this.ascending = Ascending;
76 string[] Fields =
new string[this.nrColumns];
79 for (i = 0; i < this.nrColumns; i++)
82 Fields[i] = this.ascending[i] ? s :
"-" + s;
107 if (!this.columns.ForAllChildNodes(Callback, State, Order))
114 if (!(this.name is
null))
116 b = !Callback(this.name, out NewNode, State);
117 if (!(NewNode is
null))
123 if (b || (Order ==
SearchMethod.TreeOrder && !
this.name.ForAllChildNodes(Callback, State, Order)))
127 if (!(this.source is
null))
129 b = !Callback(this.source, out NewNode, State);
132 this.source = Source2;
136 if (b || (Order ==
SearchMethod.TreeOrder && !
this.source.ForAllChildNodes(Callback, State, Order)))
142 for (i = 0; i < this.nrColumns; i++)
147 b = !Callback(Node, out NewNode, State);
148 if (!(NewNode is
null))
150 this.columns[i] = NewNode;
151 NewNode.SetParent(
this);
168 if (!this.columns.ForAllChildNodes(Callback, State, Order))
181 AreEqual(this.columns, O.columns) &&
182 AreEqual(this.ascending, O.ascending) &&
189 int Result = base.GetHashCode();
193 Result ^= Result << 5 ^
GetHashCode(this.ascending);
Class managing a script expression.
Base class for all nodes in a parsed script tree.
bool ForAllChildNodes(ScriptNodeEventHandler Callback, object State, bool DepthFirst)
Calls the callback method for all child nodes.
int Length
Length of expression covered by node.
static bool AreEqual(ScriptNode S1, ScriptNode S2)
Compares if two script nodes are equal.
int Start
Start position in script expression.
void SetParent(ScriptNode Parent)
Sets the parent node. Can only be used when expression is being parsed.
Executes an CREATE INDEX ... ON ... (...) statement against the object database.
override int GetHashCode()
CreateIndex(ScriptNode Name, SourceDefinition Source, ScriptNode[] Columns, bool[] Ascending, int Start, int Length, Expression Expression)
Executes an CREATE INDEX ... ON ... (...) statement against the object database.
override IElement Evaluate(Variables Variables)
Evaluates the node, using the variables provided in the Variables collection.
override bool ForAllChildNodes(ScriptNodeEventHandler Callback, object State, SearchMethod Order)
Calls the callback method for all child nodes.
override bool IsAsynchronous
If the node (or its decendants) include asynchronous evaluation. Asynchronous nodes should be evaluat...
override bool Equals(object obj)
override async Task< IElement > EvaluateAsync(Variables Variables)
Evaluates the node asynchronously, using the variables provided in the Variables collection.
Executes an INSERT ... VALUES ... statement against the object database.
static async Task< string > GetNameAsync(ScriptNode Node, Variables Variables)
Gets a name from a script node, either by using the name of a variable reference, or evaluating the n...
Abstract base class for source definitions
abstract Task< IDataSource > GetSource(Variables Variables)
Gets the actual data source, from its definition.
Basic interface for all types of elements.
Interface for script nodes with asynchronous evaluation
Interface for data sources that can be used in SQL statements.
Task CreateIndex(string Name, string[] Fields)
Creates an index in the source.
delegate bool ScriptNodeEventHandler(ScriptNode Node, out ScriptNode NewNode, object State)
Delegate for ScriptNode callback methods.
SearchMethod
Method to traverse the expression structure