2using System.Collections.Generic;
3using System.Threading.Tasks;
20 private readonly XmlDocument xmlDocument;
21 private readonly XmlNode xmlNode;
23 private readonly
string name;
24 private readonly
string alias;
35 this.xmlDocument = Xml;
51 this.xmlDocument =
null;
70 KeyValuePair<VariableReference, bool>[] Order,
ScriptNode Node)
73 if (WhereXPath is
null && !(Where is
null))
74 throw new ScriptRuntimeException(
"WHERE clause must use an XPATH expression when selecting nodes from XML.", Where);
78 if (WhereXPath is
null)
79 Obj =
new ObjectValue(this.xmlDocument ?? this.xmlNode);
87 Vector = Operators.Vectors.VectorDefinition.
Encapsulate(
new IElement[] { Obj },
false, Node);
97 public Task
Update(
bool Lazy, IEnumerable<object> Objects)
99 return Task.CompletedTask;
102 private Exception InvalidOperation()
119 KeyValuePair<VariableReference, bool>[] Order,
ScriptNode Node)
121 throw this.InvalidOperation();
129 public Task
Insert(
bool Lazy,
object Object)
131 throw this.InvalidOperation();
155 get =>
string.IsNullOrEmpty(this.alias) ? this.name : this.alias;
166 string.Compare(this.name,
Name,
true) == 0 ||
167 string.Compare(this.alias,
Name,
true) == 0;
177 return Task.FromResult(
false);
187 throw this.InvalidOperation();
197 throw InvalidOperation();
205 throw InvalidOperation();
Script runtime exception.
Base class for all nodes in a parsed script tree.
Node repesenting an XPath expression
override IElement Evaluate(Variables Variables)
Evaluates the node, using the variables provided in the Variables collection.
Data Source defined by a vector.
Task< IResultSetEnumerator > Find(int Offset, int Top, bool Generic, ScriptNode Where, Variables Variables, KeyValuePair< VariableReference, bool >[] Order, ScriptNode Node)
Finds objects matching filter conditions in Where .
Data Source defined by XML.
Task< IResultSetEnumerator > Find(int Offset, int Top, bool Generic, ScriptNode Where, Variables Variables, KeyValuePair< VariableReference, bool >[] Order, ScriptNode Node)
Finds objects matching filter conditions in Where .
Task< int?> FindDelete(bool Lazy, int Offset, int Top, ScriptNode Where, Variables Variables, KeyValuePair< VariableReference, bool >[] Order, ScriptNode Node)
Finds and Deletes a set of objects.
string Name
Collection name or alias.
Task< bool > DropIndex(string Name)
Drops an index from the source.
Task Update(bool Lazy, IEnumerable< object > Objects)
Updates a set of objects.
string TypeName
Name of corresponding type.
Task Insert(bool Lazy, object Object)
Inserts an object.
Task DropCollection()
Drops the collection from the source.
Task< bool > IsLabel(string Label)
Checks if the label is a label in the source.
XmlSource(string Name, string Alias, XmlDocument Xml, ScriptNode Node)
Data Source defined by XML.
Task CreateIndex(string Name, string[] Fields)
Creates an index in the source.
bool IsSource(string Name)
Checks if the name refers to the source.
string CollectionName
Name of corresponding collection.
XmlSource(string Name, string Alias, XmlNode Xml, ScriptNode Node)
Data Source defined by XML.
Basic interface for all types of elements.
IElement Encapsulate(ICollection< IElement > Elements, ScriptNode Node)
Encapsulates a set of elements into a similar structure as that provided by the current element.
Basic interface for vectors.
Interface for data sources that can be used in SQL statements.