private ITable FilterByIndex(ITable table, IIndexSetDataSource index, Expression order, string compareFunction, SqlObject value) { return FilterByIndex(table, index, order, compareFunction, new SqlObject[] { value }); }
private SubsetTable FilterByIndex(ITable table, IIndexSetDataSource index, Expression order, SelectableRange range) { // Select from the index and return the subset IRowCursor rows = index.Select(range); SubsetTable filteredTable = new SubsetTable(table, rows); filteredTable.OrderComposite = order; // If the number of rows selected from the index is the same as the // original table, then it is safe for index requests to fallthrough to the // parent. long selectCount = rows.Count; long originalCount = table.RowCount; if (selectCount == originalCount) filteredTable.IndexRequestFallthrough = true; // Assert we didn't select more than in the original context if (selectCount > originalCount) throw new ApplicationException( "Index found more values than in parent table."); return filteredTable; }
private ITable FilterByIndex(ITable table, IIndexSetDataSource index, Expression order, string compareFunction, SqlObject[] values) { // Make a selectable range set SelectableRange range = SelectableRange.Full; range = range.Intersect(SelectableRange.GetOperatorFromFunction(compareFunction), values); // And return the subset return FilterByIndex(table, index, order, range); }
internal void RebuildIndex(TableName tableName, IIndexSetDataSource indexSet) { IMutableTable table = GetTable(tableName); indexSet.Clear(); IRowCursor cursor = table.GetRowCursor(); while (cursor.MoveNext()) { RowId rowid = cursor.Current; indexSet.Insert(rowid); } }