public static long Delete(RecordSet Extent, Predicate Where) { long n = 0; RecordSet rs = new RecordSet(Extent.Columns); RecordWriter w = rs.OpenWriter(); FastReadPlan plan = new FastReadPlan(Extent, Where.NOT, new FNodeSet(Extent.Columns), w); plan.Execute(); w.Close(); n = Extent.Count - rs.Count; Extent._Cache = rs._Cache; return n; //long n = 0; //StaticRegister mem = new StaticRegister(null); //Where.AssignRegister(mem); //for (int i = Extent.Count - 1; i >= 0; i--) //{ // mem.Assign(Extent[i]); // if (Where.Render()) // { // Extent.Remove(i); // n++; // } //} //return n; }
// RecordSet SELECTS // public static RecordSet SELECT(DataSet Data, FNodeSet Nodes, Predicate Where) { RecordSet rs = new RecordSet(Nodes.Columns); RecordWriter w = rs.OpenWriter(); FastReadPlan plan = new FastReadPlan(Data, Where, Nodes, w); plan.Execute(); w.Close(); return rs; }
public override RecordSet Extend(DataSet Data, FNodeSet ClusterVariables, FNodeSet OtherKeepers, Predicate Where) { // Check that the ClusterVariable count matches the internal node set count // if (ClusterVariables.Count != this._fields.Count) throw new ArgumentException("The cluster variable count passed does not match the internal cluster variable count"); // Create the selectors // FNodeSet values = OtherKeepers.CloneOfMe(); FNode n = new FNodeResult(null, new RowClusterCellFunction(this._rule, this._means)); foreach (FNode t in ClusterVariables.Nodes) { n.AddChildNode(t.CloneOfMe()); } values.Add("CLUSTER_ID", n); // Build a recordset // RecordSet rs = new RecordSet(values.Columns); RecordWriter w = rs.OpenWriter(); // Run a fast select // FastReadPlan plan = new FastReadPlan(Data, Where, values, w); plan.Execute(); w.Close(); return rs; }
// Table SELECTS // public static Table SELECT(string Dir, string Name, DataSet Data, FNodeSet Nodes, Predicate Where) { Table rs = new Table(Dir, Name, Nodes.Columns); RecordWriter w = rs.OpenWriter(); FastReadPlan plan = new FastReadPlan(Data, Where, Nodes, w); plan.Execute(); w.Close(); return rs; }